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);
2647 rte_flow_error_set(error, EINVAL,
2648 RTE_FLOW_ERROR_TYPE_ITEM,
2650 "Invalid MAC_addr mask.");
2654 if (eth_spec && eth_mask &&
2655 next_type == RTE_FLOW_ITEM_TYPE_END) {
2656 if (eth_mask->type != RTE_BE16(0xffff)) {
2657 rte_flow_error_set(error, EINVAL,
2658 RTE_FLOW_ERROR_TYPE_ITEM,
2660 "Invalid type mask.");
2664 ether_type = rte_be_to_cpu_16(eth_spec->type);
2666 if (next_type == RTE_FLOW_ITEM_TYPE_VLAN ||
2667 ether_type == RTE_ETHER_TYPE_IPV4 ||
2668 ether_type == RTE_ETHER_TYPE_IPV6 ||
2669 ether_type == outer_tpid) {
2670 rte_flow_error_set(error, EINVAL,
2671 RTE_FLOW_ERROR_TYPE_ITEM,
2673 "Unsupported ether_type.");
2676 input_set |= I40E_INSET_LAST_ETHER_TYPE;
2677 filter->input.flow.l2_flow.ether_type =
2681 pctype = I40E_FILTER_PCTYPE_L2_PAYLOAD;
2682 layer_idx = I40E_FLXPLD_L2_IDX;
2685 case RTE_FLOW_ITEM_TYPE_VLAN:
2686 vlan_spec = item->spec;
2687 vlan_mask = item->mask;
2689 RTE_ASSERT(!(input_set & I40E_INSET_LAST_ETHER_TYPE));
2690 if (vlan_spec && vlan_mask) {
2691 if (vlan_mask->tci ==
2692 rte_cpu_to_be_16(I40E_TCI_MASK)) {
2693 input_set |= I40E_INSET_VLAN_INNER;
2694 filter->input.flow_ext.vlan_tci =
2698 if (vlan_spec && vlan_mask && vlan_mask->inner_type) {
2699 if (vlan_mask->inner_type != RTE_BE16(0xffff)) {
2700 rte_flow_error_set(error, EINVAL,
2701 RTE_FLOW_ERROR_TYPE_ITEM,
2703 "Invalid inner_type"
2709 rte_be_to_cpu_16(vlan_spec->inner_type);
2711 if (ether_type == RTE_ETHER_TYPE_IPV4 ||
2712 ether_type == RTE_ETHER_TYPE_IPV6 ||
2713 ether_type == outer_tpid) {
2714 rte_flow_error_set(error, EINVAL,
2715 RTE_FLOW_ERROR_TYPE_ITEM,
2717 "Unsupported inner_type.");
2720 input_set |= I40E_INSET_LAST_ETHER_TYPE;
2721 filter->input.flow.l2_flow.ether_type =
2722 vlan_spec->inner_type;
2725 pctype = I40E_FILTER_PCTYPE_L2_PAYLOAD;
2726 layer_idx = I40E_FLXPLD_L2_IDX;
2729 case RTE_FLOW_ITEM_TYPE_IPV4:
2730 l3 = RTE_FLOW_ITEM_TYPE_IPV4;
2731 ipv4_spec = item->spec;
2732 ipv4_mask = item->mask;
2733 pctype = I40E_FILTER_PCTYPE_NONF_IPV4_OTHER;
2734 layer_idx = I40E_FLXPLD_L3_IDX;
2736 if (ipv4_spec && ipv4_mask && outer_ip) {
2737 /* Check IPv4 mask and update input set */
2738 if (ipv4_mask->hdr.version_ihl ||
2739 ipv4_mask->hdr.total_length ||
2740 ipv4_mask->hdr.packet_id ||
2741 ipv4_mask->hdr.fragment_offset ||
2742 ipv4_mask->hdr.hdr_checksum) {
2743 rte_flow_error_set(error, EINVAL,
2744 RTE_FLOW_ERROR_TYPE_ITEM,
2746 "Invalid IPv4 mask.");
2750 if (ipv4_mask->hdr.src_addr == UINT32_MAX)
2751 input_set |= I40E_INSET_IPV4_SRC;
2752 if (ipv4_mask->hdr.dst_addr == UINT32_MAX)
2753 input_set |= I40E_INSET_IPV4_DST;
2754 if (ipv4_mask->hdr.type_of_service == UINT8_MAX)
2755 input_set |= I40E_INSET_IPV4_TOS;
2756 if (ipv4_mask->hdr.time_to_live == UINT8_MAX)
2757 input_set |= I40E_INSET_IPV4_TTL;
2758 if (ipv4_mask->hdr.next_proto_id == UINT8_MAX)
2759 input_set |= I40E_INSET_IPV4_PROTO;
2761 /* Check if it is fragment. */
2762 frag_off = ipv4_spec->hdr.fragment_offset;
2763 frag_off = rte_be_to_cpu_16(frag_off);
2764 if (frag_off & RTE_IPV4_HDR_OFFSET_MASK ||
2765 frag_off & RTE_IPV4_HDR_MF_FLAG)
2766 pctype = I40E_FILTER_PCTYPE_FRAG_IPV4;
2768 if (input_set & (I40E_INSET_DMAC | I40E_INSET_SMAC)) {
2769 if (input_set & (I40E_INSET_IPV4_SRC |
2770 I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS |
2771 I40E_INSET_IPV4_TTL | I40E_INSET_IPV4_PROTO)) {
2772 rte_flow_error_set(error, EINVAL,
2773 RTE_FLOW_ERROR_TYPE_ITEM,
2775 "L2 and L3 input set are exclusive.");
2779 /* Get the filter info */
2780 filter->input.flow.ip4_flow.proto =
2781 ipv4_spec->hdr.next_proto_id;
2782 filter->input.flow.ip4_flow.tos =
2783 ipv4_spec->hdr.type_of_service;
2784 filter->input.flow.ip4_flow.ttl =
2785 ipv4_spec->hdr.time_to_live;
2786 filter->input.flow.ip4_flow.src_ip =
2787 ipv4_spec->hdr.src_addr;
2788 filter->input.flow.ip4_flow.dst_ip =
2789 ipv4_spec->hdr.dst_addr;
2791 filter->input.flow_ext.inner_ip = false;
2792 filter->input.flow_ext.oip_type =
2793 I40E_FDIR_IPTYPE_IPV4;
2795 } else if (!ipv4_spec && !ipv4_mask && !outer_ip) {
2796 filter->input.flow_ext.inner_ip = true;
2797 filter->input.flow_ext.iip_type =
2798 I40E_FDIR_IPTYPE_IPV4;
2799 } else if (!ipv4_spec && !ipv4_mask && outer_ip) {
2800 filter->input.flow_ext.inner_ip = false;
2801 filter->input.flow_ext.oip_type =
2802 I40E_FDIR_IPTYPE_IPV4;
2803 } else if ((ipv4_spec || ipv4_mask) && !outer_ip) {
2804 rte_flow_error_set(error, EINVAL,
2805 RTE_FLOW_ERROR_TYPE_ITEM,
2807 "Invalid inner IPv4 mask.");
2815 case RTE_FLOW_ITEM_TYPE_IPV6:
2816 l3 = RTE_FLOW_ITEM_TYPE_IPV6;
2817 ipv6_spec = item->spec;
2818 ipv6_mask = item->mask;
2819 pctype = I40E_FILTER_PCTYPE_NONF_IPV6_OTHER;
2820 layer_idx = I40E_FLXPLD_L3_IDX;
2822 if (ipv6_spec && ipv6_mask && outer_ip) {
2823 /* Check IPv6 mask and update input set */
2824 if (ipv6_mask->hdr.payload_len) {
2825 rte_flow_error_set(error, EINVAL,
2826 RTE_FLOW_ERROR_TYPE_ITEM,
2828 "Invalid IPv6 mask");
2832 if (!memcmp(ipv6_mask->hdr.src_addr,
2834 RTE_DIM(ipv6_mask->hdr.src_addr)))
2835 input_set |= I40E_INSET_IPV6_SRC;
2836 if (!memcmp(ipv6_mask->hdr.dst_addr,
2838 RTE_DIM(ipv6_mask->hdr.dst_addr)))
2839 input_set |= I40E_INSET_IPV6_DST;
2841 if ((ipv6_mask->hdr.vtc_flow &
2842 rte_cpu_to_be_32(I40E_IPV6_TC_MASK))
2843 == rte_cpu_to_be_32(I40E_IPV6_TC_MASK))
2844 input_set |= I40E_INSET_IPV6_TC;
2845 if (ipv6_mask->hdr.proto == UINT8_MAX)
2846 input_set |= I40E_INSET_IPV6_NEXT_HDR;
2847 if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
2848 input_set |= I40E_INSET_IPV6_HOP_LIMIT;
2850 /* Get filter info */
2852 rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow);
2853 filter->input.flow.ipv6_flow.tc =
2854 (uint8_t)(vtc_flow_cpu >>
2855 I40E_FDIR_IPv6_TC_OFFSET);
2856 filter->input.flow.ipv6_flow.proto =
2857 ipv6_spec->hdr.proto;
2858 filter->input.flow.ipv6_flow.hop_limits =
2859 ipv6_spec->hdr.hop_limits;
2861 filter->input.flow_ext.inner_ip = false;
2862 filter->input.flow_ext.oip_type =
2863 I40E_FDIR_IPTYPE_IPV6;
2865 rte_memcpy(filter->input.flow.ipv6_flow.src_ip,
2866 ipv6_spec->hdr.src_addr, 16);
2867 rte_memcpy(filter->input.flow.ipv6_flow.dst_ip,
2868 ipv6_spec->hdr.dst_addr, 16);
2870 /* Check if it is fragment. */
2871 if (ipv6_spec->hdr.proto ==
2872 I40E_IPV6_FRAG_HEADER)
2873 pctype = I40E_FILTER_PCTYPE_FRAG_IPV6;
2874 } else if (!ipv6_spec && !ipv6_mask && !outer_ip) {
2875 filter->input.flow_ext.inner_ip = true;
2876 filter->input.flow_ext.iip_type =
2877 I40E_FDIR_IPTYPE_IPV6;
2878 } else if (!ipv6_spec && !ipv6_mask && outer_ip) {
2879 filter->input.flow_ext.inner_ip = false;
2880 filter->input.flow_ext.oip_type =
2881 I40E_FDIR_IPTYPE_IPV6;
2882 } else if ((ipv6_spec || ipv6_mask) && !outer_ip) {
2883 rte_flow_error_set(error, EINVAL,
2884 RTE_FLOW_ERROR_TYPE_ITEM,
2886 "Invalid inner IPv6 mask");
2893 case RTE_FLOW_ITEM_TYPE_TCP:
2894 tcp_spec = item->spec;
2895 tcp_mask = item->mask;
2897 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
2899 I40E_FILTER_PCTYPE_NONF_IPV4_TCP;
2900 else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
2902 I40E_FILTER_PCTYPE_NONF_IPV6_TCP;
2903 if (tcp_spec && tcp_mask) {
2904 /* Check TCP mask and update input set */
2905 if (tcp_mask->hdr.sent_seq ||
2906 tcp_mask->hdr.recv_ack ||
2907 tcp_mask->hdr.data_off ||
2908 tcp_mask->hdr.tcp_flags ||
2909 tcp_mask->hdr.rx_win ||
2910 tcp_mask->hdr.cksum ||
2911 tcp_mask->hdr.tcp_urp) {
2912 rte_flow_error_set(error, EINVAL,
2913 RTE_FLOW_ERROR_TYPE_ITEM,
2915 "Invalid TCP mask");
2919 if (tcp_mask->hdr.src_port == UINT16_MAX)
2920 input_set |= I40E_INSET_SRC_PORT;
2921 if (tcp_mask->hdr.dst_port == UINT16_MAX)
2922 input_set |= I40E_INSET_DST_PORT;
2924 if (input_set & (I40E_INSET_DMAC | I40E_INSET_SMAC)) {
2926 (I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT)) {
2927 rte_flow_error_set(error, EINVAL,
2928 RTE_FLOW_ERROR_TYPE_ITEM,
2930 "L2 and L4 input set are exclusive.");
2934 /* Get filter info */
2935 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
2936 filter->input.flow.tcp4_flow.src_port =
2937 tcp_spec->hdr.src_port;
2938 filter->input.flow.tcp4_flow.dst_port =
2939 tcp_spec->hdr.dst_port;
2940 } else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
2941 filter->input.flow.tcp6_flow.src_port =
2942 tcp_spec->hdr.src_port;
2943 filter->input.flow.tcp6_flow.dst_port =
2944 tcp_spec->hdr.dst_port;
2949 layer_idx = I40E_FLXPLD_L4_IDX;
2952 case RTE_FLOW_ITEM_TYPE_UDP:
2953 udp_spec = item->spec;
2954 udp_mask = item->mask;
2956 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
2958 I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
2959 else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
2961 I40E_FILTER_PCTYPE_NONF_IPV6_UDP;
2963 if (udp_spec && udp_mask) {
2964 /* Check UDP mask and update input set*/
2965 if (udp_mask->hdr.dgram_len ||
2966 udp_mask->hdr.dgram_cksum) {
2967 rte_flow_error_set(error, EINVAL,
2968 RTE_FLOW_ERROR_TYPE_ITEM,
2970 "Invalid UDP mask");
2974 if (udp_mask->hdr.src_port == UINT16_MAX)
2975 input_set |= I40E_INSET_SRC_PORT;
2976 if (udp_mask->hdr.dst_port == UINT16_MAX)
2977 input_set |= I40E_INSET_DST_PORT;
2979 if (input_set & (I40E_INSET_DMAC | I40E_INSET_SMAC)) {
2981 (I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT)) {
2982 rte_flow_error_set(error, EINVAL,
2983 RTE_FLOW_ERROR_TYPE_ITEM,
2985 "L2 and L4 input set are exclusive.");
2989 /* Get filter info */
2990 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
2991 filter->input.flow.udp4_flow.src_port =
2992 udp_spec->hdr.src_port;
2993 filter->input.flow.udp4_flow.dst_port =
2994 udp_spec->hdr.dst_port;
2995 } else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
2996 filter->input.flow.udp6_flow.src_port =
2997 udp_spec->hdr.src_port;
2998 filter->input.flow.udp6_flow.dst_port =
2999 udp_spec->hdr.dst_port;
3003 filter->input.flow_ext.is_udp = true;
3004 layer_idx = I40E_FLXPLD_L4_IDX;
3007 case RTE_FLOW_ITEM_TYPE_GTPC:
3008 case RTE_FLOW_ITEM_TYPE_GTPU:
3009 if (!pf->gtp_support) {
3010 rte_flow_error_set(error, EINVAL,
3011 RTE_FLOW_ERROR_TYPE_ITEM,
3013 "Unsupported protocol");
3017 gtp_spec = item->spec;
3018 gtp_mask = item->mask;
3020 if (gtp_spec && gtp_mask) {
3021 if (gtp_mask->v_pt_rsv_flags ||
3022 gtp_mask->msg_type ||
3023 gtp_mask->msg_len ||
3024 gtp_mask->teid != UINT32_MAX) {
3025 rte_flow_error_set(error, EINVAL,
3026 RTE_FLOW_ERROR_TYPE_ITEM,
3028 "Invalid GTP mask");
3032 filter->input.flow.gtp_flow.teid =
3034 filter->input.flow_ext.customized_pctype = true;
3035 cus_proto = item_type;
3038 case RTE_FLOW_ITEM_TYPE_ESP:
3039 if (!pf->esp_support) {
3040 rte_flow_error_set(error, EINVAL,
3041 RTE_FLOW_ERROR_TYPE_ITEM,
3043 "Unsupported ESP protocol");
3047 esp_spec = item->spec;
3048 esp_mask = item->mask;
3050 if (!esp_spec || !esp_mask) {
3051 rte_flow_error_set(error, EINVAL,
3052 RTE_FLOW_ERROR_TYPE_ITEM,
3054 "Invalid ESP item");
3058 if (esp_spec && esp_mask) {
3059 if (esp_mask->hdr.spi != UINT32_MAX) {
3060 rte_flow_error_set(error, EINVAL,
3061 RTE_FLOW_ERROR_TYPE_ITEM,
3063 "Invalid ESP mask");
3066 i40e_flow_set_filter_spi(filter, esp_spec);
3067 filter->input.flow_ext.customized_pctype = true;
3068 cus_proto = item_type;
3071 case RTE_FLOW_ITEM_TYPE_SCTP:
3072 sctp_spec = item->spec;
3073 sctp_mask = item->mask;
3075 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
3077 I40E_FILTER_PCTYPE_NONF_IPV4_SCTP;
3078 else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
3080 I40E_FILTER_PCTYPE_NONF_IPV6_SCTP;
3082 if (sctp_spec && sctp_mask) {
3083 /* Check SCTP mask and update input set */
3084 if (sctp_mask->hdr.cksum) {
3085 rte_flow_error_set(error, EINVAL,
3086 RTE_FLOW_ERROR_TYPE_ITEM,
3088 "Invalid UDP mask");
3092 if (sctp_mask->hdr.src_port == UINT16_MAX)
3093 input_set |= I40E_INSET_SRC_PORT;
3094 if (sctp_mask->hdr.dst_port == UINT16_MAX)
3095 input_set |= I40E_INSET_DST_PORT;
3096 if (sctp_mask->hdr.tag == UINT32_MAX)
3097 input_set |= I40E_INSET_SCTP_VT;
3099 /* Get filter info */
3100 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
3101 filter->input.flow.sctp4_flow.src_port =
3102 sctp_spec->hdr.src_port;
3103 filter->input.flow.sctp4_flow.dst_port =
3104 sctp_spec->hdr.dst_port;
3105 filter->input.flow.sctp4_flow.verify_tag
3106 = sctp_spec->hdr.tag;
3107 } else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
3108 filter->input.flow.sctp6_flow.src_port =
3109 sctp_spec->hdr.src_port;
3110 filter->input.flow.sctp6_flow.dst_port =
3111 sctp_spec->hdr.dst_port;
3112 filter->input.flow.sctp6_flow.verify_tag
3113 = sctp_spec->hdr.tag;
3117 layer_idx = I40E_FLXPLD_L4_IDX;
3120 case RTE_FLOW_ITEM_TYPE_RAW:
3121 raw_spec = item->spec;
3122 raw_mask = item->mask;
3124 if (!raw_spec || !raw_mask) {
3125 rte_flow_error_set(error, EINVAL,
3126 RTE_FLOW_ERROR_TYPE_ITEM,
3128 "NULL RAW spec/mask");
3132 if (pf->support_multi_driver) {
3133 rte_flow_error_set(error, ENOTSUP,
3134 RTE_FLOW_ERROR_TYPE_ITEM,
3136 "Unsupported flexible payload.");
3140 ret = i40e_flow_check_raw_item(item, raw_spec, error);
3144 off_arr[raw_id] = raw_spec->offset;
3145 len_arr[raw_id] = raw_spec->length;
3148 memset(&flex_pit, 0, sizeof(struct i40e_fdir_flex_pit));
3150 raw_spec->length / sizeof(uint16_t);
3151 flex_pit.dst_offset =
3152 next_dst_off / sizeof(uint16_t);
3154 for (i = 0; i <= raw_id; i++) {
3156 flex_pit.src_offset +=
3160 flex_pit.src_offset +=
3161 (off_arr[i] + len_arr[i]) /
3163 flex_size += len_arr[i];
3165 if (((flex_pit.src_offset + flex_pit.size) >=
3166 I40E_MAX_FLX_SOURCE_OFF / sizeof(uint16_t)) ||
3167 flex_size > I40E_FDIR_MAX_FLEXLEN) {
3168 rte_flow_error_set(error, EINVAL,
3169 RTE_FLOW_ERROR_TYPE_ITEM,
3171 "Exceeds maxmial payload limit.");
3175 /* Store flex pit to SW */
3176 ret = i40e_flow_store_flex_pit(pf, &flex_pit,
3179 rte_flow_error_set(error, EINVAL,
3180 RTE_FLOW_ERROR_TYPE_ITEM,
3182 "Conflict with the first flexible rule.");
3185 cfg_flex_pit = false;
3187 for (i = 0; i < raw_spec->length; i++) {
3188 j = i + next_dst_off;
3189 filter->input.flow_ext.flexbytes[j] =
3190 raw_spec->pattern[i];
3191 flex_mask[j] = raw_mask->pattern[i];
3194 next_dst_off += raw_spec->length;
3197 case RTE_FLOW_ITEM_TYPE_VF:
3198 vf_spec = item->spec;
3199 if (!attr->transfer) {
3200 rte_flow_error_set(error, ENOTSUP,
3201 RTE_FLOW_ERROR_TYPE_ITEM,
3203 "Matching VF traffic"
3204 " without affecting it"
3205 " (transfer attribute)"
3209 filter->input.flow_ext.is_vf = 1;
3210 filter->input.flow_ext.dst_id = vf_spec->id;
3211 if (filter->input.flow_ext.is_vf &&
3212 filter->input.flow_ext.dst_id >= pf->vf_num) {
3213 rte_flow_error_set(error, EINVAL,
3214 RTE_FLOW_ERROR_TYPE_ITEM,
3216 "Invalid VF ID for FDIR.");
3220 case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
3221 l2tpv3oip_spec = item->spec;
3222 l2tpv3oip_mask = item->mask;
3224 if (!l2tpv3oip_spec || !l2tpv3oip_mask)
3227 if (l2tpv3oip_mask->session_id != UINT32_MAX) {
3228 rte_flow_error_set(error, EINVAL,
3229 RTE_FLOW_ERROR_TYPE_ITEM,
3231 "Invalid L2TPv3 mask");
3235 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
3236 filter->input.flow.ip4_l2tpv3oip_flow.session_id =
3237 l2tpv3oip_spec->session_id;
3238 filter->input.flow_ext.oip_type =
3239 I40E_FDIR_IPTYPE_IPV4;
3240 } else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
3241 filter->input.flow.ip6_l2tpv3oip_flow.session_id =
3242 l2tpv3oip_spec->session_id;
3243 filter->input.flow_ext.oip_type =
3244 I40E_FDIR_IPTYPE_IPV6;
3247 filter->input.flow_ext.customized_pctype = true;
3248 cus_proto = item_type;
3255 /* Get customized pctype value */
3256 if (filter->input.flow_ext.customized_pctype) {
3257 pctype = i40e_flow_fdir_get_pctype_value(pf, cus_proto, filter);
3258 if (pctype == I40E_FILTER_PCTYPE_INVALID) {
3259 rte_flow_error_set(error, EINVAL,
3260 RTE_FLOW_ERROR_TYPE_ITEM,
3262 "Unsupported pctype");
3267 /* If customized pctype is not used, set fdir configuration.*/
3268 if (!filter->input.flow_ext.customized_pctype) {
3269 ret = i40e_flow_set_fdir_inset(pf, pctype, input_set);
3271 rte_flow_error_set(error, EINVAL,
3272 RTE_FLOW_ERROR_TYPE_ITEM, item,
3273 "Conflict with the first rule's input set.");
3275 } else if (ret == -EINVAL) {
3276 rte_flow_error_set(error, EINVAL,
3277 RTE_FLOW_ERROR_TYPE_ITEM, item,
3278 "Invalid pattern mask.");
3282 /* Store flex mask to SW */
3283 ret = i40e_flow_store_flex_mask(pf, pctype, flex_mask);
3285 rte_flow_error_set(error, EINVAL,
3286 RTE_FLOW_ERROR_TYPE_ITEM,
3288 "Exceed maximal number of bitmasks");
3290 } else if (ret == -2) {
3291 rte_flow_error_set(error, EINVAL,
3292 RTE_FLOW_ERROR_TYPE_ITEM,
3294 "Conflict with the first flexible rule");
3297 cfg_flex_msk = false;
3300 i40e_flow_set_fdir_flex_pit(pf, layer_idx, raw_id);
3303 i40e_flow_set_fdir_flex_msk(pf, pctype);
3306 filter->input.pctype = pctype;
3311 /* Parse to get the action info of a FDIR filter.
3312 * FDIR action supports QUEUE or (QUEUE + MARK).
3315 i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
3316 const struct rte_flow_action *actions,
3317 struct rte_flow_error *error,
3318 struct i40e_fdir_filter_conf *filter)
3320 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
3321 const struct rte_flow_action *act;
3322 const struct rte_flow_action_queue *act_q;
3323 const struct rte_flow_action_mark *mark_spec = NULL;
3326 /* Check if the first non-void action is QUEUE or DROP or PASSTHRU. */
3327 NEXT_ITEM_OF_ACTION(act, actions, index);
3328 switch (act->type) {
3329 case RTE_FLOW_ACTION_TYPE_QUEUE:
3331 filter->action.rx_queue = act_q->index;
3332 if ((!filter->input.flow_ext.is_vf &&
3333 filter->action.rx_queue >= pf->dev_data->nb_rx_queues) ||
3334 (filter->input.flow_ext.is_vf &&
3335 filter->action.rx_queue >= pf->vf_nb_qps)) {
3336 rte_flow_error_set(error, EINVAL,
3337 RTE_FLOW_ERROR_TYPE_ACTION, act,
3338 "Invalid queue ID for FDIR.");
3341 filter->action.behavior = I40E_FDIR_ACCEPT;
3343 case RTE_FLOW_ACTION_TYPE_DROP:
3344 filter->action.behavior = I40E_FDIR_REJECT;
3346 case RTE_FLOW_ACTION_TYPE_PASSTHRU:
3347 filter->action.behavior = I40E_FDIR_PASSTHRU;
3349 case RTE_FLOW_ACTION_TYPE_MARK:
3350 filter->action.behavior = I40E_FDIR_PASSTHRU;
3351 mark_spec = act->conf;
3352 filter->action.report_status = I40E_FDIR_REPORT_ID;
3353 filter->soft_id = mark_spec->id;
3356 rte_flow_error_set(error, EINVAL,
3357 RTE_FLOW_ERROR_TYPE_ACTION, act,
3362 /* Check if the next non-void item is MARK or FLAG or END. */
3364 NEXT_ITEM_OF_ACTION(act, actions, index);
3365 switch (act->type) {
3366 case RTE_FLOW_ACTION_TYPE_MARK:
3368 /* Double MARK actions requested */
3369 rte_flow_error_set(error, EINVAL,
3370 RTE_FLOW_ERROR_TYPE_ACTION, act,
3374 mark_spec = act->conf;
3375 filter->action.report_status = I40E_FDIR_REPORT_ID;
3376 filter->soft_id = mark_spec->id;
3378 case RTE_FLOW_ACTION_TYPE_FLAG:
3380 /* MARK + FLAG not supported */
3381 rte_flow_error_set(error, EINVAL,
3382 RTE_FLOW_ERROR_TYPE_ACTION, act,
3386 filter->action.report_status = I40E_FDIR_NO_REPORT_STATUS;
3388 case RTE_FLOW_ACTION_TYPE_RSS:
3389 if (filter->action.behavior != I40E_FDIR_PASSTHRU) {
3390 /* RSS filter won't be next if FDIR did not pass thru */
3391 rte_flow_error_set(error, EINVAL,
3392 RTE_FLOW_ERROR_TYPE_ACTION, act,
3397 case RTE_FLOW_ACTION_TYPE_END:
3400 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
3401 act, "Invalid action.");
3405 /* Check if the next non-void item is END */
3407 NEXT_ITEM_OF_ACTION(act, actions, index);
3408 if (act->type != RTE_FLOW_ACTION_TYPE_END) {
3409 rte_flow_error_set(error, EINVAL,
3410 RTE_FLOW_ERROR_TYPE_ACTION,
3411 act, "Invalid action.");
3419 i40e_flow_parse_fdir_filter(struct rte_eth_dev *dev,
3420 const struct rte_flow_attr *attr,
3421 const struct rte_flow_item pattern[],
3422 const struct rte_flow_action actions[],
3423 struct rte_flow_error *error,
3424 union i40e_filter_t *filter)
3426 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
3427 struct i40e_fdir_filter_conf *fdir_filter =
3428 &filter->fdir_filter;
3431 ret = i40e_flow_parse_fdir_pattern(dev, attr, pattern, error,
3436 ret = i40e_flow_parse_fdir_action(dev, actions, error, fdir_filter);
3440 ret = i40e_flow_parse_attr(attr, error);
3444 cons_filter_type = RTE_ETH_FILTER_FDIR;
3446 if (pf->fdir.fdir_vsi == NULL) {
3447 /* Enable fdir when fdir flow is added at first time. */
3448 ret = i40e_fdir_setup(pf);
3449 if (ret != I40E_SUCCESS) {
3450 rte_flow_error_set(error, ENOTSUP,
3451 RTE_FLOW_ERROR_TYPE_HANDLE,
3452 NULL, "Failed to setup fdir.");
3455 ret = i40e_fdir_configure(dev);
3457 rte_flow_error_set(error, ENOTSUP,
3458 RTE_FLOW_ERROR_TYPE_HANDLE,
3459 NULL, "Failed to configure fdir.");
3466 i40e_fdir_teardown(pf);
3470 /* Parse to get the action info of a tunnel filter
3471 * Tunnel action only supports PF, VF and QUEUE.
3474 i40e_flow_parse_tunnel_action(struct rte_eth_dev *dev,
3475 const struct rte_flow_action *actions,
3476 struct rte_flow_error *error,
3477 struct i40e_tunnel_filter_conf *filter)
3479 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
3480 const struct rte_flow_action *act;
3481 const struct rte_flow_action_queue *act_q;
3482 const struct rte_flow_action_vf *act_vf;
3485 /* Check if the first non-void action is PF or VF. */
3486 NEXT_ITEM_OF_ACTION(act, actions, index);
3487 if (act->type != RTE_FLOW_ACTION_TYPE_PF &&
3488 act->type != RTE_FLOW_ACTION_TYPE_VF) {
3489 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
3490 act, "Not supported action.");
3494 if (act->type == RTE_FLOW_ACTION_TYPE_VF) {
3496 filter->vf_id = act_vf->id;
3497 filter->is_to_vf = 1;
3498 if (filter->vf_id >= pf->vf_num) {
3499 rte_flow_error_set(error, EINVAL,
3500 RTE_FLOW_ERROR_TYPE_ACTION,
3501 act, "Invalid VF ID for tunnel filter");
3506 /* Check if the next non-void item is QUEUE */
3508 NEXT_ITEM_OF_ACTION(act, actions, index);
3509 if (act->type == RTE_FLOW_ACTION_TYPE_QUEUE) {
3511 filter->queue_id = act_q->index;
3512 if ((!filter->is_to_vf) &&
3513 (filter->queue_id >= pf->dev_data->nb_rx_queues)) {
3514 rte_flow_error_set(error, EINVAL,
3515 RTE_FLOW_ERROR_TYPE_ACTION,
3516 act, "Invalid queue ID for tunnel filter");
3518 } else if (filter->is_to_vf &&
3519 (filter->queue_id >= pf->vf_nb_qps)) {
3520 rte_flow_error_set(error, EINVAL,
3521 RTE_FLOW_ERROR_TYPE_ACTION,
3522 act, "Invalid queue ID for tunnel filter");
3527 /* Check if the next non-void item is END */
3529 NEXT_ITEM_OF_ACTION(act, actions, index);
3530 if (act->type != RTE_FLOW_ACTION_TYPE_END) {
3531 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
3532 act, "Not supported action.");
3539 static uint16_t i40e_supported_tunnel_filter_types[] = {
3540 ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_TENID |
3541 ETH_TUNNEL_FILTER_IVLAN,
3542 ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_IVLAN,
3543 ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_TENID,
3544 ETH_TUNNEL_FILTER_OMAC | ETH_TUNNEL_FILTER_TENID |
3545 ETH_TUNNEL_FILTER_IMAC,
3546 ETH_TUNNEL_FILTER_IMAC,
3550 i40e_check_tunnel_filter_type(uint8_t filter_type)
3554 for (i = 0; i < RTE_DIM(i40e_supported_tunnel_filter_types); i++) {
3555 if (filter_type == i40e_supported_tunnel_filter_types[i])
3562 /* 1. Last in item should be NULL as range is not supported.
3563 * 2. Supported filter types: IMAC_IVLAN_TENID, IMAC_IVLAN,
3564 * IMAC_TENID, OMAC_TENID_IMAC and IMAC.
3565 * 3. Mask of fields which need to be matched should be
3567 * 4. Mask of fields which needn't to be matched should be
3571 i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev,
3572 const struct rte_flow_item *pattern,
3573 struct rte_flow_error *error,
3574 struct i40e_tunnel_filter_conf *filter)
3576 const struct rte_flow_item *item = pattern;
3577 const struct rte_flow_item_eth *eth_spec;
3578 const struct rte_flow_item_eth *eth_mask;
3579 const struct rte_flow_item_vxlan *vxlan_spec;
3580 const struct rte_flow_item_vxlan *vxlan_mask;
3581 const struct rte_flow_item_vlan *vlan_spec;
3582 const struct rte_flow_item_vlan *vlan_mask;
3583 uint8_t filter_type = 0;
3584 bool is_vni_masked = 0;
3585 uint8_t vni_mask[] = {0xFF, 0xFF, 0xFF};
3586 enum rte_flow_item_type item_type;
3587 bool vxlan_flag = 0;
3588 uint32_t tenant_id_be = 0;
3591 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
3593 rte_flow_error_set(error, EINVAL,
3594 RTE_FLOW_ERROR_TYPE_ITEM,
3596 "Not support range");
3599 item_type = item->type;
3600 switch (item_type) {
3601 case RTE_FLOW_ITEM_TYPE_ETH:
3602 eth_spec = item->spec;
3603 eth_mask = item->mask;
3605 /* Check if ETH item is used for place holder.
3606 * If yes, both spec and mask should be NULL.
3607 * If no, both spec and mask shouldn't be NULL.
3609 if ((!eth_spec && eth_mask) ||
3610 (eth_spec && !eth_mask)) {
3611 rte_flow_error_set(error, EINVAL,
3612 RTE_FLOW_ERROR_TYPE_ITEM,
3614 "Invalid ether spec/mask");
3618 if (eth_spec && eth_mask) {
3619 /* DST address of inner MAC shouldn't be masked.
3620 * SRC address of Inner MAC should be masked.
3622 if (!rte_is_broadcast_ether_addr(ð_mask->dst) ||
3623 !rte_is_zero_ether_addr(ð_mask->src) ||
3625 rte_flow_error_set(error, EINVAL,
3626 RTE_FLOW_ERROR_TYPE_ITEM,
3628 "Invalid ether spec/mask");
3633 rte_memcpy(&filter->outer_mac,
3635 RTE_ETHER_ADDR_LEN);
3636 filter_type |= ETH_TUNNEL_FILTER_OMAC;
3638 rte_memcpy(&filter->inner_mac,
3640 RTE_ETHER_ADDR_LEN);
3641 filter_type |= ETH_TUNNEL_FILTER_IMAC;
3645 case RTE_FLOW_ITEM_TYPE_VLAN:
3646 vlan_spec = item->spec;
3647 vlan_mask = item->mask;
3648 if (!(vlan_spec && vlan_mask) ||
3649 vlan_mask->inner_type) {
3650 rte_flow_error_set(error, EINVAL,
3651 RTE_FLOW_ERROR_TYPE_ITEM,
3653 "Invalid vlan item");
3657 if (vlan_spec && vlan_mask) {
3658 if (vlan_mask->tci ==
3659 rte_cpu_to_be_16(I40E_TCI_MASK))
3660 filter->inner_vlan =
3661 rte_be_to_cpu_16(vlan_spec->tci) &
3663 filter_type |= ETH_TUNNEL_FILTER_IVLAN;
3666 case RTE_FLOW_ITEM_TYPE_IPV4:
3667 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV4;
3668 /* IPv4 is used to describe protocol,
3669 * spec and mask should be NULL.
3671 if (item->spec || item->mask) {
3672 rte_flow_error_set(error, EINVAL,
3673 RTE_FLOW_ERROR_TYPE_ITEM,
3675 "Invalid IPv4 item");
3679 case RTE_FLOW_ITEM_TYPE_IPV6:
3680 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV6;
3681 /* IPv6 is used to describe protocol,
3682 * spec and mask should be NULL.
3684 if (item->spec || item->mask) {
3685 rte_flow_error_set(error, EINVAL,
3686 RTE_FLOW_ERROR_TYPE_ITEM,
3688 "Invalid IPv6 item");
3692 case RTE_FLOW_ITEM_TYPE_UDP:
3693 /* UDP is used to describe protocol,
3694 * spec and mask should be NULL.
3696 if (item->spec || item->mask) {
3697 rte_flow_error_set(error, EINVAL,
3698 RTE_FLOW_ERROR_TYPE_ITEM,
3700 "Invalid UDP item");
3704 case RTE_FLOW_ITEM_TYPE_VXLAN:
3705 vxlan_spec = item->spec;
3706 vxlan_mask = item->mask;
3707 /* Check if VXLAN item is used to describe protocol.
3708 * If yes, both spec and mask should be NULL.
3709 * If no, both spec and mask shouldn't be NULL.
3711 if ((!vxlan_spec && vxlan_mask) ||
3712 (vxlan_spec && !vxlan_mask)) {
3713 rte_flow_error_set(error, EINVAL,
3714 RTE_FLOW_ERROR_TYPE_ITEM,
3716 "Invalid VXLAN item");
3720 /* Check if VNI is masked. */
3721 if (vxlan_spec && vxlan_mask) {
3723 !!memcmp(vxlan_mask->vni, vni_mask,
3725 if (is_vni_masked) {
3726 rte_flow_error_set(error, EINVAL,
3727 RTE_FLOW_ERROR_TYPE_ITEM,
3729 "Invalid VNI mask");
3733 rte_memcpy(((uint8_t *)&tenant_id_be + 1),
3734 vxlan_spec->vni, 3);
3736 rte_be_to_cpu_32(tenant_id_be);
3737 filter_type |= ETH_TUNNEL_FILTER_TENID;
3747 ret = i40e_check_tunnel_filter_type(filter_type);
3749 rte_flow_error_set(error, EINVAL,
3750 RTE_FLOW_ERROR_TYPE_ITEM,
3752 "Invalid filter type");
3755 filter->filter_type = filter_type;
3757 filter->tunnel_type = I40E_TUNNEL_TYPE_VXLAN;
3763 i40e_flow_parse_vxlan_filter(struct rte_eth_dev *dev,
3764 const struct rte_flow_attr *attr,
3765 const struct rte_flow_item pattern[],
3766 const struct rte_flow_action actions[],
3767 struct rte_flow_error *error,
3768 union i40e_filter_t *filter)
3770 struct i40e_tunnel_filter_conf *tunnel_filter =
3771 &filter->consistent_tunnel_filter;
3774 ret = i40e_flow_parse_vxlan_pattern(dev, pattern,
3775 error, tunnel_filter);
3779 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
3783 ret = i40e_flow_parse_attr(attr, error);
3787 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
3792 /* 1. Last in item should be NULL as range is not supported.
3793 * 2. Supported filter types: IMAC_IVLAN_TENID, IMAC_IVLAN,
3794 * IMAC_TENID, OMAC_TENID_IMAC and IMAC.
3795 * 3. Mask of fields which need to be matched should be
3797 * 4. Mask of fields which needn't to be matched should be
3801 i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev,
3802 const struct rte_flow_item *pattern,
3803 struct rte_flow_error *error,
3804 struct i40e_tunnel_filter_conf *filter)
3806 const struct rte_flow_item *item = pattern;
3807 const struct rte_flow_item_eth *eth_spec;
3808 const struct rte_flow_item_eth *eth_mask;
3809 const struct rte_flow_item_nvgre *nvgre_spec;
3810 const struct rte_flow_item_nvgre *nvgre_mask;
3811 const struct rte_flow_item_vlan *vlan_spec;
3812 const struct rte_flow_item_vlan *vlan_mask;
3813 enum rte_flow_item_type item_type;
3814 uint8_t filter_type = 0;
3815 bool is_tni_masked = 0;
3816 uint8_t tni_mask[] = {0xFF, 0xFF, 0xFF};
3817 bool nvgre_flag = 0;
3818 uint32_t tenant_id_be = 0;
3821 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
3823 rte_flow_error_set(error, EINVAL,
3824 RTE_FLOW_ERROR_TYPE_ITEM,
3826 "Not support range");
3829 item_type = item->type;
3830 switch (item_type) {
3831 case RTE_FLOW_ITEM_TYPE_ETH:
3832 eth_spec = item->spec;
3833 eth_mask = item->mask;
3835 /* Check if ETH item is used for place holder.
3836 * If yes, both spec and mask should be NULL.
3837 * If no, both spec and mask shouldn't be NULL.
3839 if ((!eth_spec && eth_mask) ||
3840 (eth_spec && !eth_mask)) {
3841 rte_flow_error_set(error, EINVAL,
3842 RTE_FLOW_ERROR_TYPE_ITEM,
3844 "Invalid ether spec/mask");
3848 if (eth_spec && eth_mask) {
3849 /* DST address of inner MAC shouldn't be masked.
3850 * SRC address of Inner MAC should be masked.
3852 if (!rte_is_broadcast_ether_addr(ð_mask->dst) ||
3853 !rte_is_zero_ether_addr(ð_mask->src) ||
3855 rte_flow_error_set(error, EINVAL,
3856 RTE_FLOW_ERROR_TYPE_ITEM,
3858 "Invalid ether spec/mask");
3863 rte_memcpy(&filter->outer_mac,
3865 RTE_ETHER_ADDR_LEN);
3866 filter_type |= ETH_TUNNEL_FILTER_OMAC;
3868 rte_memcpy(&filter->inner_mac,
3870 RTE_ETHER_ADDR_LEN);
3871 filter_type |= ETH_TUNNEL_FILTER_IMAC;
3876 case RTE_FLOW_ITEM_TYPE_VLAN:
3877 vlan_spec = item->spec;
3878 vlan_mask = item->mask;
3879 if (!(vlan_spec && vlan_mask) ||
3880 vlan_mask->inner_type) {
3881 rte_flow_error_set(error, EINVAL,
3882 RTE_FLOW_ERROR_TYPE_ITEM,
3884 "Invalid vlan item");
3888 if (vlan_spec && vlan_mask) {
3889 if (vlan_mask->tci ==
3890 rte_cpu_to_be_16(I40E_TCI_MASK))
3891 filter->inner_vlan =
3892 rte_be_to_cpu_16(vlan_spec->tci) &
3894 filter_type |= ETH_TUNNEL_FILTER_IVLAN;
3897 case RTE_FLOW_ITEM_TYPE_IPV4:
3898 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV4;
3899 /* IPv4 is used to describe protocol,
3900 * spec and mask should be NULL.
3902 if (item->spec || item->mask) {
3903 rte_flow_error_set(error, EINVAL,
3904 RTE_FLOW_ERROR_TYPE_ITEM,
3906 "Invalid IPv4 item");
3910 case RTE_FLOW_ITEM_TYPE_IPV6:
3911 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV6;
3912 /* IPv6 is used to describe protocol,
3913 * spec and mask should be NULL.
3915 if (item->spec || item->mask) {
3916 rte_flow_error_set(error, EINVAL,
3917 RTE_FLOW_ERROR_TYPE_ITEM,
3919 "Invalid IPv6 item");
3923 case RTE_FLOW_ITEM_TYPE_NVGRE:
3924 nvgre_spec = item->spec;
3925 nvgre_mask = item->mask;
3926 /* Check if NVGRE item is used to describe protocol.
3927 * If yes, both spec and mask should be NULL.
3928 * If no, both spec and mask shouldn't be NULL.
3930 if ((!nvgre_spec && nvgre_mask) ||
3931 (nvgre_spec && !nvgre_mask)) {
3932 rte_flow_error_set(error, EINVAL,
3933 RTE_FLOW_ERROR_TYPE_ITEM,
3935 "Invalid NVGRE item");
3939 if (nvgre_spec && nvgre_mask) {
3941 !!memcmp(nvgre_mask->tni, tni_mask,
3943 if (is_tni_masked) {
3944 rte_flow_error_set(error, EINVAL,
3945 RTE_FLOW_ERROR_TYPE_ITEM,
3947 "Invalid TNI mask");
3950 if (nvgre_mask->protocol &&
3951 nvgre_mask->protocol != 0xFFFF) {
3952 rte_flow_error_set(error, EINVAL,
3953 RTE_FLOW_ERROR_TYPE_ITEM,
3955 "Invalid NVGRE item");
3958 if (nvgre_mask->c_k_s_rsvd0_ver &&
3959 nvgre_mask->c_k_s_rsvd0_ver !=
3960 rte_cpu_to_be_16(0xFFFF)) {
3961 rte_flow_error_set(error, EINVAL,
3962 RTE_FLOW_ERROR_TYPE_ITEM,
3964 "Invalid NVGRE item");
3967 if (nvgre_spec->c_k_s_rsvd0_ver !=
3968 rte_cpu_to_be_16(0x2000) &&
3969 nvgre_mask->c_k_s_rsvd0_ver) {
3970 rte_flow_error_set(error, EINVAL,
3971 RTE_FLOW_ERROR_TYPE_ITEM,
3973 "Invalid NVGRE item");
3976 if (nvgre_mask->protocol &&
3977 nvgre_spec->protocol !=
3978 rte_cpu_to_be_16(0x6558)) {
3979 rte_flow_error_set(error, EINVAL,
3980 RTE_FLOW_ERROR_TYPE_ITEM,
3982 "Invalid NVGRE item");
3985 rte_memcpy(((uint8_t *)&tenant_id_be + 1),
3986 nvgre_spec->tni, 3);
3988 rte_be_to_cpu_32(tenant_id_be);
3989 filter_type |= ETH_TUNNEL_FILTER_TENID;
3999 ret = i40e_check_tunnel_filter_type(filter_type);
4001 rte_flow_error_set(error, EINVAL,
4002 RTE_FLOW_ERROR_TYPE_ITEM,
4004 "Invalid filter type");
4007 filter->filter_type = filter_type;
4009 filter->tunnel_type = I40E_TUNNEL_TYPE_NVGRE;
4015 i40e_flow_parse_nvgre_filter(struct rte_eth_dev *dev,
4016 const struct rte_flow_attr *attr,
4017 const struct rte_flow_item pattern[],
4018 const struct rte_flow_action actions[],
4019 struct rte_flow_error *error,
4020 union i40e_filter_t *filter)
4022 struct i40e_tunnel_filter_conf *tunnel_filter =
4023 &filter->consistent_tunnel_filter;
4026 ret = i40e_flow_parse_nvgre_pattern(dev, pattern,
4027 error, tunnel_filter);
4031 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
4035 ret = i40e_flow_parse_attr(attr, error);
4039 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
4044 /* 1. Last in item should be NULL as range is not supported.
4045 * 2. Supported filter types: MPLS label.
4046 * 3. Mask of fields which need to be matched should be
4048 * 4. Mask of fields which needn't to be matched should be
4052 i40e_flow_parse_mpls_pattern(__rte_unused struct rte_eth_dev *dev,
4053 const struct rte_flow_item *pattern,
4054 struct rte_flow_error *error,
4055 struct i40e_tunnel_filter_conf *filter)
4057 const struct rte_flow_item *item = pattern;
4058 const struct rte_flow_item_mpls *mpls_spec;
4059 const struct rte_flow_item_mpls *mpls_mask;
4060 enum rte_flow_item_type item_type;
4061 bool is_mplsoudp = 0; /* 1 - MPLSoUDP, 0 - MPLSoGRE */
4062 const uint8_t label_mask[3] = {0xFF, 0xFF, 0xF0};
4063 uint32_t label_be = 0;
4065 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
4067 rte_flow_error_set(error, EINVAL,
4068 RTE_FLOW_ERROR_TYPE_ITEM,
4070 "Not support range");
4073 item_type = item->type;
4074 switch (item_type) {
4075 case RTE_FLOW_ITEM_TYPE_ETH:
4076 if (item->spec || item->mask) {
4077 rte_flow_error_set(error, EINVAL,
4078 RTE_FLOW_ERROR_TYPE_ITEM,
4080 "Invalid ETH item");
4084 case RTE_FLOW_ITEM_TYPE_IPV4:
4085 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV4;
4086 /* IPv4 is used to describe protocol,
4087 * spec and mask should be NULL.
4089 if (item->spec || item->mask) {
4090 rte_flow_error_set(error, EINVAL,
4091 RTE_FLOW_ERROR_TYPE_ITEM,
4093 "Invalid IPv4 item");
4097 case RTE_FLOW_ITEM_TYPE_IPV6:
4098 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV6;
4099 /* IPv6 is used to describe protocol,
4100 * spec and mask should be NULL.
4102 if (item->spec || item->mask) {
4103 rte_flow_error_set(error, EINVAL,
4104 RTE_FLOW_ERROR_TYPE_ITEM,
4106 "Invalid IPv6 item");
4110 case RTE_FLOW_ITEM_TYPE_UDP:
4111 /* UDP is used to describe protocol,
4112 * spec and mask should be NULL.
4114 if (item->spec || item->mask) {
4115 rte_flow_error_set(error, EINVAL,
4116 RTE_FLOW_ERROR_TYPE_ITEM,
4118 "Invalid UDP item");
4123 case RTE_FLOW_ITEM_TYPE_GRE:
4124 /* GRE is used to describe protocol,
4125 * spec and mask should be NULL.
4127 if (item->spec || item->mask) {
4128 rte_flow_error_set(error, EINVAL,
4129 RTE_FLOW_ERROR_TYPE_ITEM,
4131 "Invalid GRE item");
4135 case RTE_FLOW_ITEM_TYPE_MPLS:
4136 mpls_spec = item->spec;
4137 mpls_mask = item->mask;
4139 if (!mpls_spec || !mpls_mask) {
4140 rte_flow_error_set(error, EINVAL,
4141 RTE_FLOW_ERROR_TYPE_ITEM,
4143 "Invalid MPLS item");
4147 if (memcmp(mpls_mask->label_tc_s, label_mask, 3)) {
4148 rte_flow_error_set(error, EINVAL,
4149 RTE_FLOW_ERROR_TYPE_ITEM,
4151 "Invalid MPLS label mask");
4154 rte_memcpy(((uint8_t *)&label_be + 1),
4155 mpls_spec->label_tc_s, 3);
4156 filter->tenant_id = rte_be_to_cpu_32(label_be) >> 4;
4164 filter->tunnel_type = I40E_TUNNEL_TYPE_MPLSoUDP;
4166 filter->tunnel_type = I40E_TUNNEL_TYPE_MPLSoGRE;
4172 i40e_flow_parse_mpls_filter(struct rte_eth_dev *dev,
4173 const struct rte_flow_attr *attr,
4174 const struct rte_flow_item pattern[],
4175 const struct rte_flow_action actions[],
4176 struct rte_flow_error *error,
4177 union i40e_filter_t *filter)
4179 struct i40e_tunnel_filter_conf *tunnel_filter =
4180 &filter->consistent_tunnel_filter;
4183 ret = i40e_flow_parse_mpls_pattern(dev, pattern,
4184 error, tunnel_filter);
4188 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
4192 ret = i40e_flow_parse_attr(attr, error);
4196 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
4201 /* 1. Last in item should be NULL as range is not supported.
4202 * 2. Supported filter types: GTP TEID.
4203 * 3. Mask of fields which need to be matched should be
4205 * 4. Mask of fields which needn't to be matched should be
4207 * 5. GTP profile supports GTPv1 only.
4208 * 6. GTP-C response message ('source_port' = 2123) is not supported.
4211 i40e_flow_parse_gtp_pattern(struct rte_eth_dev *dev,
4212 const struct rte_flow_item *pattern,
4213 struct rte_flow_error *error,
4214 struct i40e_tunnel_filter_conf *filter)
4216 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
4217 const struct rte_flow_item *item = pattern;
4218 const struct rte_flow_item_gtp *gtp_spec;
4219 const struct rte_flow_item_gtp *gtp_mask;
4220 enum rte_flow_item_type item_type;
4222 if (!pf->gtp_support) {
4223 rte_flow_error_set(error, EINVAL,
4224 RTE_FLOW_ERROR_TYPE_ITEM,
4226 "GTP is not supported by default.");
4230 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
4232 rte_flow_error_set(error, EINVAL,
4233 RTE_FLOW_ERROR_TYPE_ITEM,
4235 "Not support range");
4238 item_type = item->type;
4239 switch (item_type) {
4240 case RTE_FLOW_ITEM_TYPE_ETH:
4241 if (item->spec || item->mask) {
4242 rte_flow_error_set(error, EINVAL,
4243 RTE_FLOW_ERROR_TYPE_ITEM,
4245 "Invalid ETH item");
4249 case RTE_FLOW_ITEM_TYPE_IPV4:
4250 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV4;
4251 /* IPv4 is used to describe protocol,
4252 * spec and mask should be NULL.
4254 if (item->spec || item->mask) {
4255 rte_flow_error_set(error, EINVAL,
4256 RTE_FLOW_ERROR_TYPE_ITEM,
4258 "Invalid IPv4 item");
4262 case RTE_FLOW_ITEM_TYPE_UDP:
4263 if (item->spec || item->mask) {
4264 rte_flow_error_set(error, EINVAL,
4265 RTE_FLOW_ERROR_TYPE_ITEM,
4267 "Invalid UDP item");
4271 case RTE_FLOW_ITEM_TYPE_GTPC:
4272 case RTE_FLOW_ITEM_TYPE_GTPU:
4273 gtp_spec = item->spec;
4274 gtp_mask = item->mask;
4276 if (!gtp_spec || !gtp_mask) {
4277 rte_flow_error_set(error, EINVAL,
4278 RTE_FLOW_ERROR_TYPE_ITEM,
4280 "Invalid GTP item");
4284 if (gtp_mask->v_pt_rsv_flags ||
4285 gtp_mask->msg_type ||
4286 gtp_mask->msg_len ||
4287 gtp_mask->teid != UINT32_MAX) {
4288 rte_flow_error_set(error, EINVAL,
4289 RTE_FLOW_ERROR_TYPE_ITEM,
4291 "Invalid GTP mask");
4295 if (item_type == RTE_FLOW_ITEM_TYPE_GTPC)
4296 filter->tunnel_type = I40E_TUNNEL_TYPE_GTPC;
4297 else if (item_type == RTE_FLOW_ITEM_TYPE_GTPU)
4298 filter->tunnel_type = I40E_TUNNEL_TYPE_GTPU;
4300 filter->tenant_id = rte_be_to_cpu_32(gtp_spec->teid);
4312 i40e_flow_parse_gtp_filter(struct rte_eth_dev *dev,
4313 const struct rte_flow_attr *attr,
4314 const struct rte_flow_item pattern[],
4315 const struct rte_flow_action actions[],
4316 struct rte_flow_error *error,
4317 union i40e_filter_t *filter)
4319 struct i40e_tunnel_filter_conf *tunnel_filter =
4320 &filter->consistent_tunnel_filter;
4323 ret = i40e_flow_parse_gtp_pattern(dev, pattern,
4324 error, tunnel_filter);
4328 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
4332 ret = i40e_flow_parse_attr(attr, error);
4336 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
4341 /* 1. Last in item should be NULL as range is not supported.
4342 * 2. Supported filter types: QINQ.
4343 * 3. Mask of fields which need to be matched should be
4345 * 4. Mask of fields which needn't to be matched should be
4349 i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
4350 const struct rte_flow_item *pattern,
4351 struct rte_flow_error *error,
4352 struct i40e_tunnel_filter_conf *filter)
4354 const struct rte_flow_item *item = pattern;
4355 const struct rte_flow_item_vlan *vlan_spec = NULL;
4356 const struct rte_flow_item_vlan *vlan_mask = NULL;
4357 const struct rte_flow_item_vlan *i_vlan_spec = NULL;
4358 const struct rte_flow_item_vlan *i_vlan_mask = NULL;
4359 const struct rte_flow_item_vlan *o_vlan_spec = NULL;
4360 const struct rte_flow_item_vlan *o_vlan_mask = NULL;
4362 enum rte_flow_item_type item_type;
4365 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
4367 rte_flow_error_set(error, EINVAL,
4368 RTE_FLOW_ERROR_TYPE_ITEM,
4370 "Not support range");
4373 item_type = item->type;
4374 switch (item_type) {
4375 case RTE_FLOW_ITEM_TYPE_ETH:
4376 if (item->spec || item->mask) {
4377 rte_flow_error_set(error, EINVAL,
4378 RTE_FLOW_ERROR_TYPE_ITEM,
4380 "Invalid ETH item");
4384 case RTE_FLOW_ITEM_TYPE_VLAN:
4385 vlan_spec = item->spec;
4386 vlan_mask = item->mask;
4388 if (!(vlan_spec && vlan_mask) ||
4389 vlan_mask->inner_type) {
4390 rte_flow_error_set(error, EINVAL,
4391 RTE_FLOW_ERROR_TYPE_ITEM,
4393 "Invalid vlan item");
4398 o_vlan_spec = vlan_spec;
4399 o_vlan_mask = vlan_mask;
4402 i_vlan_spec = vlan_spec;
4403 i_vlan_mask = vlan_mask;
4413 /* Get filter specification */
4414 if ((o_vlan_mask != NULL) && (o_vlan_mask->tci ==
4415 rte_cpu_to_be_16(I40E_TCI_MASK)) &&
4416 (i_vlan_mask != NULL) &&
4417 (i_vlan_mask->tci == rte_cpu_to_be_16(I40E_TCI_MASK))) {
4418 filter->outer_vlan = rte_be_to_cpu_16(o_vlan_spec->tci)
4420 filter->inner_vlan = rte_be_to_cpu_16(i_vlan_spec->tci)
4423 rte_flow_error_set(error, EINVAL,
4424 RTE_FLOW_ERROR_TYPE_ITEM,
4426 "Invalid filter type");
4430 filter->tunnel_type = I40E_TUNNEL_TYPE_QINQ;
4435 i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
4436 const struct rte_flow_attr *attr,
4437 const struct rte_flow_item pattern[],
4438 const struct rte_flow_action actions[],
4439 struct rte_flow_error *error,
4440 union i40e_filter_t *filter)
4442 struct i40e_tunnel_filter_conf *tunnel_filter =
4443 &filter->consistent_tunnel_filter;
4446 ret = i40e_flow_parse_qinq_pattern(dev, pattern,
4447 error, tunnel_filter);
4451 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
4455 ret = i40e_flow_parse_attr(attr, error);
4459 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
4465 * This function is used to do configuration i40e existing RSS with rte_flow.
4466 * It also enable queue region configuration using flow API for i40e.
4467 * pattern can be used indicate what parameters will be include in flow,
4468 * like user_priority or flowtype for queue region or HASH function for RSS.
4469 * Action is used to transmit parameter like queue index and HASH
4470 * function for RSS, or flowtype for queue region configuration.
4473 * Case 1: try to transform patterns to pctype. valid pctype will be
4474 * used in parse action.
4475 * Case 2: only ETH, indicate flowtype for queue region will be parsed.
4476 * Case 3: only VLAN, indicate user_priority for queue region will be parsed.
4477 * So, pattern choice is depened on the purpose of configuration of
4480 * action RSS will be used to transmit valid parameter with
4481 * struct rte_flow_action_rss for all the 3 case.
4484 i40e_flow_parse_rss_pattern(__rte_unused struct rte_eth_dev *dev,
4485 const struct rte_flow_item *pattern,
4486 struct rte_flow_error *error,
4487 struct i40e_rss_pattern_info *p_info,
4488 struct i40e_queue_regions *info)
4490 const struct rte_flow_item_vlan *vlan_spec, *vlan_mask;
4491 const struct rte_flow_item *item = pattern;
4492 enum rte_flow_item_type item_type;
4493 struct rte_flow_item *items;
4494 uint32_t item_num = 0; /* non-void item number of pattern*/
4496 static const struct {
4497 enum rte_flow_item_type *item_array;
4499 } i40e_rss_pctype_patterns[] = {
4500 { pattern_fdir_ipv4,
4501 ETH_RSS_FRAG_IPV4 | ETH_RSS_NONFRAG_IPV4_OTHER },
4502 { pattern_fdir_ipv4_tcp, ETH_RSS_NONFRAG_IPV4_TCP },
4503 { pattern_fdir_ipv4_udp, ETH_RSS_NONFRAG_IPV4_UDP },
4504 { pattern_fdir_ipv4_sctp, ETH_RSS_NONFRAG_IPV4_SCTP },
4505 { pattern_fdir_ipv4_esp, ETH_RSS_ESP },
4506 { pattern_fdir_ipv4_udp_esp, ETH_RSS_ESP },
4507 { pattern_fdir_ipv6,
4508 ETH_RSS_FRAG_IPV6 | ETH_RSS_NONFRAG_IPV6_OTHER },
4509 { pattern_fdir_ipv6_tcp, ETH_RSS_NONFRAG_IPV6_TCP },
4510 { pattern_fdir_ipv6_udp, ETH_RSS_NONFRAG_IPV6_UDP },
4511 { pattern_fdir_ipv6_sctp, ETH_RSS_NONFRAG_IPV6_SCTP },
4512 { pattern_fdir_ipv6_esp, ETH_RSS_ESP },
4513 { pattern_fdir_ipv6_udp_esp, ETH_RSS_ESP },
4516 p_info->types = I40E_RSS_TYPE_INVALID;
4518 if (item->type == RTE_FLOW_ITEM_TYPE_END) {
4519 p_info->types = I40E_RSS_TYPE_NONE;
4523 /* Convert pattern to RSS offload types */
4524 while ((pattern + i)->type != RTE_FLOW_ITEM_TYPE_END) {
4525 if ((pattern + i)->type != RTE_FLOW_ITEM_TYPE_VOID)
4531 items = rte_zmalloc("i40e_pattern",
4532 item_num * sizeof(struct rte_flow_item), 0);
4534 rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_ITEM_NUM,
4535 NULL, "No memory for PMD internal items.");
4539 i40e_pattern_skip_void_item(items, pattern);
4541 for (i = 0; i < RTE_DIM(i40e_rss_pctype_patterns); i++) {
4542 if (i40e_match_pattern(i40e_rss_pctype_patterns[i].item_array,
4544 p_info->types = i40e_rss_pctype_patterns[i].type;
4552 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
4554 rte_flow_error_set(error, EINVAL,
4555 RTE_FLOW_ERROR_TYPE_ITEM,
4557 "Not support range");
4560 item_type = item->type;
4561 switch (item_type) {
4562 case RTE_FLOW_ITEM_TYPE_ETH:
4563 p_info->action_flag = 1;
4565 case RTE_FLOW_ITEM_TYPE_VLAN:
4566 vlan_spec = item->spec;
4567 vlan_mask = item->mask;
4568 if (vlan_spec && vlan_mask) {
4569 if (vlan_mask->tci ==
4570 rte_cpu_to_be_16(I40E_TCI_MASK)) {
4571 info->region[0].user_priority[0] =
4573 vlan_spec->tci) >> 13) & 0x7;
4574 info->region[0].user_priority_num = 1;
4575 info->queue_region_number = 1;
4576 p_info->action_flag = 0;
4581 rte_flow_error_set(error, EINVAL,
4582 RTE_FLOW_ERROR_TYPE_ITEM,
4584 "Not support range");
4593 * This function is used to parse RSS queue index, total queue number and
4594 * hash functions, If the purpose of this configuration is for queue region
4595 * configuration, it will set queue_region_conf flag to TRUE, else to FALSE.
4596 * In queue region configuration, it also need to parse hardware flowtype
4597 * and user_priority from configuration, it will also cheeck the validity
4598 * of these parameters. For example, The queue region sizes should
4599 * be any of the following values: 1, 2, 4, 8, 16, 32, 64, the
4600 * hw_flowtype or PCTYPE max index should be 63, the user priority
4601 * max index should be 7, and so on. And also, queue index should be
4602 * continuous sequence and queue region index should be part of RSS
4603 * queue index for this port.
4604 * For hash params, the pctype in action and pattern must be same.
4605 * Set queue index must be with non-types.
4608 i40e_flow_parse_rss_action(struct rte_eth_dev *dev,
4609 const struct rte_flow_action *actions,
4610 struct rte_flow_error *error,
4611 struct i40e_rss_pattern_info p_info,
4612 struct i40e_queue_regions *conf_info,
4613 union i40e_filter_t *filter)
4615 const struct rte_flow_action *act;
4616 const struct rte_flow_action_rss *rss;
4617 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
4618 struct i40e_queue_regions *info = &pf->queue_region;
4619 struct i40e_rte_flow_rss_conf *rss_config =
4621 struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;
4622 uint16_t i, j, n, tmp, nb_types;
4624 uint64_t hf_bit = 1;
4626 NEXT_ITEM_OF_ACTION(act, actions, index);
4630 * RSS only supports forwarding,
4631 * check if the first not void action is RSS.
4633 if (act->type != RTE_FLOW_ACTION_TYPE_RSS) {
4634 memset(rss_config, 0, sizeof(struct i40e_rte_flow_rss_conf));
4635 rte_flow_error_set(error, EINVAL,
4636 RTE_FLOW_ERROR_TYPE_ACTION,
4637 act, "Not supported action.");
4641 if (p_info.action_flag) {
4642 for (n = 0; n < 64; n++) {
4643 if (rss->types & (hf_bit << n)) {
4644 conf_info->region[0].hw_flowtype[0] = n;
4645 conf_info->region[0].flowtype_num = 1;
4646 conf_info->queue_region_number = 1;
4653 * Do some queue region related parameters check
4654 * in order to keep queue index for queue region to be
4655 * continuous sequence and also to be part of RSS
4656 * queue index for this port.
4658 if (conf_info->queue_region_number) {
4659 for (i = 0; i < rss->queue_num; i++) {
4660 for (j = 0; j < rss_info->conf.queue_num; j++) {
4661 if (rss->queue[i] == rss_info->conf.queue[j])
4664 if (j == rss_info->conf.queue_num) {
4665 rte_flow_error_set(error, EINVAL,
4666 RTE_FLOW_ERROR_TYPE_ACTION,
4673 for (i = 0; i < rss->queue_num - 1; i++) {
4674 if (rss->queue[i + 1] != rss->queue[i] + 1) {
4675 rte_flow_error_set(error, EINVAL,
4676 RTE_FLOW_ERROR_TYPE_ACTION,
4684 /* Parse queue region related parameters from configuration */
4685 for (n = 0; n < conf_info->queue_region_number; n++) {
4686 if (conf_info->region[n].user_priority_num ||
4687 conf_info->region[n].flowtype_num) {
4688 if (!((rte_is_power_of_2(rss->queue_num)) &&
4689 rss->queue_num <= 64)) {
4690 rte_flow_error_set(error, EINVAL,
4691 RTE_FLOW_ERROR_TYPE_ACTION,
4693 "The region sizes should be any of the following values: 1, 2, 4, 8, 16, 32, 64 as long as the "
4694 "total number of queues do not exceed the VSI allocation");
4698 if (conf_info->region[n].user_priority[n] >=
4699 I40E_MAX_USER_PRIORITY) {
4700 rte_flow_error_set(error, EINVAL,
4701 RTE_FLOW_ERROR_TYPE_ACTION,
4703 "the user priority max index is 7");
4707 if (conf_info->region[n].hw_flowtype[n] >=
4708 I40E_FILTER_PCTYPE_MAX) {
4709 rte_flow_error_set(error, EINVAL,
4710 RTE_FLOW_ERROR_TYPE_ACTION,
4712 "the hw_flowtype or PCTYPE max index is 63");
4716 for (i = 0; i < info->queue_region_number; i++) {
4717 if (info->region[i].queue_num ==
4719 info->region[i].queue_start_index ==
4724 if (i == info->queue_region_number) {
4725 if (i > I40E_REGION_MAX_INDEX) {
4726 rte_flow_error_set(error, EINVAL,
4727 RTE_FLOW_ERROR_TYPE_ACTION,
4729 "the queue region max index is 7");
4733 info->region[i].queue_num =
4735 info->region[i].queue_start_index =
4737 info->region[i].region_id =
4738 info->queue_region_number;
4740 j = info->region[i].user_priority_num;
4741 tmp = conf_info->region[n].user_priority[0];
4742 if (conf_info->region[n].user_priority_num) {
4743 info->region[i].user_priority[j] = tmp;
4744 info->region[i].user_priority_num++;
4747 j = info->region[i].flowtype_num;
4748 tmp = conf_info->region[n].hw_flowtype[0];
4749 if (conf_info->region[n].flowtype_num) {
4750 info->region[i].hw_flowtype[j] = tmp;
4751 info->region[i].flowtype_num++;
4753 info->queue_region_number++;
4755 j = info->region[i].user_priority_num;
4756 tmp = conf_info->region[n].user_priority[0];
4757 if (conf_info->region[n].user_priority_num) {
4758 info->region[i].user_priority[j] = tmp;
4759 info->region[i].user_priority_num++;
4762 j = info->region[i].flowtype_num;
4763 tmp = conf_info->region[n].hw_flowtype[0];
4764 if (conf_info->region[n].flowtype_num) {
4765 info->region[i].hw_flowtype[j] = tmp;
4766 info->region[i].flowtype_num++;
4771 rss_config->queue_region_conf = TRUE;
4775 * Return function if this flow is used for queue region configuration
4777 if (rss_config->queue_region_conf)
4781 rte_flow_error_set(error, EINVAL,
4782 RTE_FLOW_ERROR_TYPE_ACTION,
4788 for (n = 0; n < rss->queue_num; n++) {
4789 if (rss->queue[n] >= dev->data->nb_rx_queues) {
4790 rte_flow_error_set(error, EINVAL,
4791 RTE_FLOW_ERROR_TYPE_ACTION,
4793 "queue id > max number of queues");
4798 if (rss->queue_num && (p_info.types || rss->types))
4799 return rte_flow_error_set
4800 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4801 "RSS types must be empty while configuring queue region");
4803 /* validate pattern and pctype */
4804 if (!(rss->types & p_info.types) &&
4805 (rss->types || p_info.types) && !rss->queue_num)
4806 return rte_flow_error_set
4807 (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
4808 act, "invalid pctype");
4811 for (n = 0; n < RTE_ETH_FLOW_MAX; n++) {
4812 if (rss->types & (hf_bit << n))
4815 return rte_flow_error_set
4816 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
4817 act, "multi pctype is not supported");
4820 if (rss->func == RTE_ETH_HASH_FUNCTION_SIMPLE_XOR &&
4821 (p_info.types || rss->types || rss->queue_num))
4822 return rte_flow_error_set
4823 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4824 "pattern, type and queues must be empty while"
4825 " setting hash function as simple_xor");
4827 if (rss->func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ &&
4828 !(p_info.types && rss->types))
4829 return rte_flow_error_set
4830 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4831 "pctype and queues can not be empty while"
4832 " setting hash function as symmetric toeplitz");
4834 /* Parse RSS related parameters from configuration */
4835 if (rss->func >= RTE_ETH_HASH_FUNCTION_MAX ||
4836 rss->func == RTE_ETH_HASH_FUNCTION_TOEPLITZ)
4837 return rte_flow_error_set
4838 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4839 "RSS hash functions are not supported");
4841 return rte_flow_error_set
4842 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4843 "a nonzero RSS encapsulation level is not supported");
4844 if (rss->key_len && rss->key_len > RTE_DIM(rss_config->key))
4845 return rte_flow_error_set
4846 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4847 "RSS hash key too large");
4848 if (rss->queue_num > RTE_DIM(rss_config->queue))
4849 return rte_flow_error_set
4850 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4851 "too many queues for RSS context");
4852 if (i40e_rss_conf_init(rss_config, rss))
4853 return rte_flow_error_set
4854 (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act,
4855 "RSS context initialization failure");
4859 /* check if the next not void action is END */
4860 NEXT_ITEM_OF_ACTION(act, actions, index);
4861 if (act->type != RTE_FLOW_ACTION_TYPE_END) {
4862 memset(rss_config, 0, sizeof(struct i40e_rte_flow_rss_conf));
4863 rte_flow_error_set(error, EINVAL,
4864 RTE_FLOW_ERROR_TYPE_ACTION,
4865 act, "Not supported action.");
4868 rss_config->queue_region_conf = FALSE;
4874 i40e_parse_rss_filter(struct rte_eth_dev *dev,
4875 const struct rte_flow_attr *attr,
4876 const struct rte_flow_item pattern[],
4877 const struct rte_flow_action actions[],
4878 union i40e_filter_t *filter,
4879 struct rte_flow_error *error)
4881 struct i40e_rss_pattern_info p_info;
4882 struct i40e_queue_regions info;
4885 memset(&info, 0, sizeof(struct i40e_queue_regions));
4886 memset(&p_info, 0, sizeof(struct i40e_rss_pattern_info));
4888 ret = i40e_flow_parse_rss_pattern(dev, pattern,
4889 error, &p_info, &info);
4893 ret = i40e_flow_parse_rss_action(dev, actions, error,
4894 p_info, &info, filter);
4898 ret = i40e_flow_parse_attr(attr, error);
4902 cons_filter_type = RTE_ETH_FILTER_HASH;
4908 i40e_config_rss_filter_set(struct rte_eth_dev *dev,
4909 struct i40e_rte_flow_rss_conf *conf)
4911 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
4912 struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
4913 struct i40e_rss_filter *rss_filter;
4916 if (conf->queue_region_conf) {
4917 ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 1);
4919 ret = i40e_config_rss_filter(pf, conf, 1);
4925 rss_filter = rte_zmalloc("i40e_rss_filter",
4926 sizeof(*rss_filter), 0);
4927 if (rss_filter == NULL) {
4928 PMD_DRV_LOG(ERR, "Failed to alloc memory.");
4931 rss_filter->rss_filter_info = *conf;
4932 /* the rule new created is always valid
4933 * the existing rule covered by new rule will be set invalid
4935 rss_filter->rss_filter_info.valid = true;
4937 TAILQ_INSERT_TAIL(&pf->rss_config_list, rss_filter, next);
4943 i40e_config_rss_filter_del(struct rte_eth_dev *dev,
4944 struct i40e_rte_flow_rss_conf *conf)
4946 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
4947 struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
4948 struct i40e_rss_filter *rss_filter;
4951 if (conf->queue_region_conf)
4952 i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
4954 i40e_config_rss_filter(pf, conf, 0);
4956 TAILQ_FOREACH_SAFE(rss_filter, &pf->rss_config_list, next, temp) {
4957 if (!memcmp(&rss_filter->rss_filter_info, conf,
4958 sizeof(struct rte_flow_action_rss))) {
4959 TAILQ_REMOVE(&pf->rss_config_list, rss_filter, next);
4960 rte_free(rss_filter);
4967 i40e_flow_validate(struct rte_eth_dev *dev,
4968 const struct rte_flow_attr *attr,
4969 const struct rte_flow_item pattern[],
4970 const struct rte_flow_action actions[],
4971 struct rte_flow_error *error)
4973 struct rte_flow_item *items; /* internal pattern w/o VOID items */
4974 parse_filter_t parse_filter;
4975 uint32_t item_num = 0; /* non-void item number of pattern*/
4978 int ret = I40E_NOT_SUPPORTED;
4981 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_NUM,
4982 NULL, "NULL pattern.");
4987 rte_flow_error_set(error, EINVAL,
4988 RTE_FLOW_ERROR_TYPE_ACTION_NUM,
4989 NULL, "NULL action.");
4994 rte_flow_error_set(error, EINVAL,
4995 RTE_FLOW_ERROR_TYPE_ATTR,
4996 NULL, "NULL attribute.");
5000 memset(&cons_filter, 0, sizeof(cons_filter));
5002 /* Get the non-void item of action */
5003 while ((actions + i)->type == RTE_FLOW_ACTION_TYPE_VOID)
5006 if ((actions + i)->type == RTE_FLOW_ACTION_TYPE_RSS) {
5007 ret = i40e_parse_rss_filter(dev, attr, pattern,
5008 actions, &cons_filter, error);
5013 /* Get the non-void item number of pattern */
5014 while ((pattern + i)->type != RTE_FLOW_ITEM_TYPE_END) {
5015 if ((pattern + i)->type != RTE_FLOW_ITEM_TYPE_VOID)
5021 items = rte_zmalloc("i40e_pattern",
5022 item_num * sizeof(struct rte_flow_item), 0);
5024 rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_ITEM_NUM,
5025 NULL, "No memory for PMD internal items.");
5029 i40e_pattern_skip_void_item(items, pattern);
5033 parse_filter = i40e_find_parse_filter_func(items, &i);
5034 if (!parse_filter && !flag) {
5035 rte_flow_error_set(error, EINVAL,
5036 RTE_FLOW_ERROR_TYPE_ITEM,
5037 pattern, "Unsupported pattern");
5042 ret = parse_filter(dev, attr, items, actions,
5043 error, &cons_filter);
5045 } while ((ret < 0) && (i < RTE_DIM(i40e_supported_patterns)));
5052 static struct rte_flow *
5053 i40e_flow_create(struct rte_eth_dev *dev,
5054 const struct rte_flow_attr *attr,
5055 const struct rte_flow_item pattern[],
5056 const struct rte_flow_action actions[],
5057 struct rte_flow_error *error)
5059 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
5060 struct rte_flow *flow;
5063 flow = rte_zmalloc("i40e_flow", sizeof(struct rte_flow), 0);
5065 rte_flow_error_set(error, ENOMEM,
5066 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5067 "Failed to allocate memory");
5071 ret = i40e_flow_validate(dev, attr, pattern, actions, error);
5075 switch (cons_filter_type) {
5076 case RTE_ETH_FILTER_ETHERTYPE:
5077 ret = i40e_ethertype_filter_set(pf,
5078 &cons_filter.ethertype_filter, 1);
5081 flow->rule = TAILQ_LAST(&pf->ethertype.ethertype_list,
5082 i40e_ethertype_filter_list);
5084 case RTE_ETH_FILTER_FDIR:
5085 ret = i40e_flow_add_del_fdir_filter(dev,
5086 &cons_filter.fdir_filter, 1);
5089 flow->rule = TAILQ_LAST(&pf->fdir.fdir_list,
5090 i40e_fdir_filter_list);
5092 case RTE_ETH_FILTER_TUNNEL:
5093 ret = i40e_dev_consistent_tunnel_filter_set(pf,
5094 &cons_filter.consistent_tunnel_filter, 1);
5097 flow->rule = TAILQ_LAST(&pf->tunnel.tunnel_list,
5098 i40e_tunnel_filter_list);
5100 case RTE_ETH_FILTER_HASH:
5101 ret = i40e_config_rss_filter_set(dev,
5102 &cons_filter.rss_conf);
5105 flow->rule = TAILQ_LAST(&pf->rss_config_list,
5106 i40e_rss_conf_list);
5112 flow->filter_type = cons_filter_type;
5113 TAILQ_INSERT_TAIL(&pf->flow_list, flow, node);
5117 rte_flow_error_set(error, -ret,
5118 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5119 "Failed to create flow.");
5125 i40e_flow_destroy(struct rte_eth_dev *dev,
5126 struct rte_flow *flow,
5127 struct rte_flow_error *error)
5129 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
5130 enum rte_filter_type filter_type = flow->filter_type;
5133 switch (filter_type) {
5134 case RTE_ETH_FILTER_ETHERTYPE:
5135 ret = i40e_flow_destroy_ethertype_filter(pf,
5136 (struct i40e_ethertype_filter *)flow->rule);
5138 case RTE_ETH_FILTER_TUNNEL:
5139 ret = i40e_flow_destroy_tunnel_filter(pf,
5140 (struct i40e_tunnel_filter *)flow->rule);
5142 case RTE_ETH_FILTER_FDIR:
5143 ret = i40e_flow_add_del_fdir_filter(dev,
5144 &((struct i40e_fdir_filter *)flow->rule)->fdir, 0);
5146 /* If the last flow is destroyed, disable fdir. */
5147 if (!ret && TAILQ_EMPTY(&pf->fdir.fdir_list)) {
5148 i40e_fdir_rx_proc_enable(dev, 0);
5151 case RTE_ETH_FILTER_HASH:
5152 ret = i40e_config_rss_filter_del(dev,
5153 &((struct i40e_rss_filter *)flow->rule)->rss_filter_info);
5156 PMD_DRV_LOG(WARNING, "Filter type (%d) not supported",
5163 TAILQ_REMOVE(&pf->flow_list, flow, node);
5166 rte_flow_error_set(error, -ret,
5167 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5168 "Failed to destroy flow.");
5174 i40e_flow_destroy_ethertype_filter(struct i40e_pf *pf,
5175 struct i40e_ethertype_filter *filter)
5177 struct i40e_hw *hw = I40E_PF_TO_HW(pf);
5178 struct i40e_ethertype_rule *ethertype_rule = &pf->ethertype;
5179 struct i40e_ethertype_filter *node;
5180 struct i40e_control_filter_stats stats;
5184 if (!(filter->flags & RTE_ETHTYPE_FLAGS_MAC))
5185 flags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC;
5186 if (filter->flags & RTE_ETHTYPE_FLAGS_DROP)
5187 flags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP;
5188 flags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE;
5190 memset(&stats, 0, sizeof(stats));
5191 ret = i40e_aq_add_rem_control_packet_filter(hw,
5192 filter->input.mac_addr.addr_bytes,
5193 filter->input.ether_type,
5194 flags, pf->main_vsi->seid,
5195 filter->queue, 0, &stats, NULL);
5199 node = i40e_sw_ethertype_filter_lookup(ethertype_rule, &filter->input);
5203 ret = i40e_sw_ethertype_filter_del(pf, &node->input);
5209 i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
5210 struct i40e_tunnel_filter *filter)
5212 struct i40e_hw *hw = I40E_PF_TO_HW(pf);
5213 struct i40e_vsi *vsi;
5214 struct i40e_pf_vf *vf;
5215 struct i40e_aqc_cloud_filters_element_bb cld_filter;
5216 struct i40e_tunnel_rule *tunnel_rule = &pf->tunnel;
5217 struct i40e_tunnel_filter *node;
5218 bool big_buffer = 0;
5221 memset(&cld_filter, 0, sizeof(cld_filter));
5222 rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac,
5223 (struct rte_ether_addr *)&cld_filter.element.outer_mac);
5224 rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac,
5225 (struct rte_ether_addr *)&cld_filter.element.inner_mac);
5226 cld_filter.element.inner_vlan = filter->input.inner_vlan;
5227 cld_filter.element.flags = filter->input.flags;
5228 cld_filter.element.tenant_id = filter->input.tenant_id;
5229 cld_filter.element.queue_number = filter->queue;
5230 rte_memcpy(cld_filter.general_fields,
5231 filter->input.general_fields,
5232 sizeof(cld_filter.general_fields));
5234 if (!filter->is_to_vf)
5237 vf = &pf->vfs[filter->vf_id];
5241 if (((filter->input.flags & I40E_AQC_ADD_CLOUD_FILTER_0X11) ==
5242 I40E_AQC_ADD_CLOUD_FILTER_0X11) ||
5243 ((filter->input.flags & I40E_AQC_ADD_CLOUD_FILTER_0X12) ==
5244 I40E_AQC_ADD_CLOUD_FILTER_0X12) ||
5245 ((filter->input.flags & I40E_AQC_ADD_CLOUD_FILTER_0X10) ==
5246 I40E_AQC_ADD_CLOUD_FILTER_0X10))
5250 ret = i40e_aq_rem_cloud_filters_bb(hw, vsi->seid,
5253 ret = i40e_aq_rem_cloud_filters(hw, vsi->seid,
5254 &cld_filter.element, 1);
5258 node = i40e_sw_tunnel_filter_lookup(tunnel_rule, &filter->input);
5262 ret = i40e_sw_tunnel_filter_del(pf, &node->input);
5268 i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
5270 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
5273 ret = i40e_flow_flush_fdir_filter(pf);
5275 rte_flow_error_set(error, -ret,
5276 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5277 "Failed to flush FDIR flows.");
5281 ret = i40e_flow_flush_ethertype_filter(pf);
5283 rte_flow_error_set(error, -ret,
5284 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5285 "Failed to ethertype flush flows.");
5289 ret = i40e_flow_flush_tunnel_filter(pf);
5291 rte_flow_error_set(error, -ret,
5292 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5293 "Failed to flush tunnel flows.");
5297 ret = i40e_flow_flush_rss_filter(dev);
5299 rte_flow_error_set(error, -ret,
5300 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5301 "Failed to flush RSS flows.");
5305 /* Disable FDIR processing as all FDIR rules are now flushed */
5306 i40e_fdir_rx_proc_enable(dev, 0);
5312 i40e_flow_flush_fdir_filter(struct i40e_pf *pf)
5314 struct rte_eth_dev *dev = pf->adapter->eth_dev;
5315 struct i40e_fdir_info *fdir_info = &pf->fdir;
5316 struct i40e_fdir_filter *fdir_filter;
5317 enum i40e_filter_pctype pctype;
5318 struct rte_flow *flow;
5322 ret = i40e_fdir_flush(dev);
5324 /* Delete FDIR filters in FDIR list. */
5325 while ((fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list))) {
5326 ret = i40e_sw_fdir_filter_del(pf,
5327 &fdir_filter->fdir.input);
5332 /* Delete FDIR flows in flow list. */
5333 TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
5334 if (flow->filter_type == RTE_ETH_FILTER_FDIR) {
5335 TAILQ_REMOVE(&pf->flow_list, flow, node);
5340 for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
5341 pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++)
5342 pf->fdir.inset_flag[pctype] = 0;
5348 /* Flush all ethertype filters */
5350 i40e_flow_flush_ethertype_filter(struct i40e_pf *pf)
5352 struct i40e_ethertype_filter_list
5353 *ethertype_list = &pf->ethertype.ethertype_list;
5354 struct i40e_ethertype_filter *filter;
5355 struct rte_flow *flow;
5359 while ((filter = TAILQ_FIRST(ethertype_list))) {
5360 ret = i40e_flow_destroy_ethertype_filter(pf, filter);
5365 /* Delete ethertype flows in flow list. */
5366 TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
5367 if (flow->filter_type == RTE_ETH_FILTER_ETHERTYPE) {
5368 TAILQ_REMOVE(&pf->flow_list, flow, node);
5376 /* Flush all tunnel filters */
5378 i40e_flow_flush_tunnel_filter(struct i40e_pf *pf)
5380 struct i40e_tunnel_filter_list
5381 *tunnel_list = &pf->tunnel.tunnel_list;
5382 struct i40e_tunnel_filter *filter;
5383 struct rte_flow *flow;
5387 while ((filter = TAILQ_FIRST(tunnel_list))) {
5388 ret = i40e_flow_destroy_tunnel_filter(pf, filter);
5393 /* Delete tunnel flows in flow list. */
5394 TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
5395 if (flow->filter_type == RTE_ETH_FILTER_TUNNEL) {
5396 TAILQ_REMOVE(&pf->flow_list, flow, node);
5404 /* remove the RSS filter */
5406 i40e_flow_flush_rss_filter(struct rte_eth_dev *dev)
5408 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
5409 struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
5410 struct rte_flow *flow;
5412 int32_t ret = -EINVAL;
5414 ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
5416 /* Delete RSS flows in flow list. */
5417 TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
5418 if (flow->filter_type != RTE_ETH_FILTER_HASH)
5422 ret = i40e_config_rss_filter_del(dev,
5423 &((struct i40e_rss_filter *)flow->rule)->rss_filter_info);
5427 TAILQ_REMOVE(&pf->flow_list, flow, node);