Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright 2016 6WIND S.A.
3 : : * Copyright 2016 Mellanox Technologies, Ltd
4 : : */
5 : :
6 : : #ifndef RTE_FLOW_H_
7 : : #define RTE_FLOW_H_
8 : :
9 : : /**
10 : : * @file
11 : : * RTE generic flow API
12 : : *
13 : : * This interface provides the ability to program packet matching and
14 : : * associated actions in hardware through flow rules.
15 : : */
16 : :
17 : : #include <stddef.h>
18 : : #include <stdint.h>
19 : :
20 : : #include <rte_compat.h>
21 : : #include <rte_common.h>
22 : : #include <rte_ether.h>
23 : : #include <rte_arp.h>
24 : : #include <rte_icmp.h>
25 : : #include <rte_ip.h>
26 : : #include <rte_sctp.h>
27 : : #include <rte_tcp.h>
28 : : #include <rte_udp.h>
29 : : #include <rte_vxlan.h>
30 : : #include <rte_esp.h>
31 : : #include <rte_higig.h>
32 : : #include <rte_ecpri.h>
33 : : #include <rte_bitops.h>
34 : : #include <rte_mbuf_dyn.h>
35 : : #include <rte_meter.h>
36 : : #include <rte_gtp.h>
37 : : #include <rte_l2tpv2.h>
38 : : #include <rte_ppp.h>
39 : : #include <rte_gre.h>
40 : : #include <rte_macsec.h>
41 : : #include <rte_ib.h>
42 : :
43 : : #include "rte_ethdev.h"
44 : :
45 : : #ifdef __cplusplus
46 : : extern "C" {
47 : : #endif
48 : :
49 : : /**
50 : : * Flow rule attributes.
51 : : *
52 : : * Priorities are set on a per rule based within groups.
53 : : *
54 : : * Lower values denote higher priority, the highest priority for a flow rule
55 : : * is 0, so that a flow that matches for than one rule, the rule with the
56 : : * lowest priority value will always be matched.
57 : : *
58 : : * Although optional, applications are encouraged to group similar rules as
59 : : * much as possible to fully take advantage of hardware capabilities
60 : : * (e.g. optimized matching) and work around limitations (e.g. a single
61 : : * pattern type possibly allowed in a given group). Applications should be
62 : : * aware that groups are not linked by default, and that they must be
63 : : * explicitly linked by the application using the JUMP action.
64 : : *
65 : : * Priority levels are arbitrary and up to the application, they
66 : : * do not need to be contiguous nor start from 0, however the maximum number
67 : : * varies between devices and may be affected by existing flow rules.
68 : : *
69 : : * If a packet is matched by several rules of a given group for a given
70 : : * priority level, the outcome is undefined. It can take any path, may be
71 : : * duplicated or even cause unrecoverable errors.
72 : : *
73 : : * Note that support for more than a single group and priority level is not
74 : : * guaranteed.
75 : : *
76 : : * At vNIC / ethdev level, flow rules can apply to inbound and / or outbound
77 : : * traffic (ingress / egress), with respect to the vNIC / ethdev in question.
78 : : * At embedded switch level, flow rules apply to all traffic seen by it
79 : : * unless fitting meta items are used to set concrete traffic source(s).
80 : : *
81 : : * Several pattern items and actions are valid and can be used in both
82 : : * directions. Those valid for only one direction are described as such.
83 : : *
84 : : * At least one direction must be specified.
85 : : *
86 : : * Specifying both directions at once for a given rule is not recommended
87 : : * but may be valid in a few cases.
88 : : */
89 : : struct rte_flow_attr {
90 : : /**
91 : : * A group is a superset of multiple rules.
92 : : * The default group is 0 and is processed for all packets.
93 : : * Rules in other groups are processed only if the group is chained
94 : : * by a jump action from a previously matched rule.
95 : : * It means the group hierarchy is made by the flow rules,
96 : : * and the group 0 is the hierarchy root.
97 : : * Note there is no automatic dead loop protection.
98 : : * @see rte_flow_action_jump
99 : : */
100 : : uint32_t group;
101 : : uint32_t priority; /**< Rule priority level within group. */
102 : : /**
103 : : * The rule in question applies to ingress traffic (non-"transfer").
104 : : */
105 : : uint32_t ingress:1;
106 : : /**
107 : : * The rule in question applies to egress traffic (non-"transfer").
108 : : */
109 : : uint32_t egress:1;
110 : : /**
111 : : * Instead of simply matching the properties of traffic as it would
112 : : * appear on a given DPDK port ID, enabling this attribute transfers
113 : : * a flow rule to the lowest possible level of any device endpoints
114 : : * found in the pattern.
115 : : *
116 : : * When supported, this effectively enables an application to
117 : : * re-route traffic not necessarily intended for it (e.g. coming
118 : : * from or addressed to different physical ports, VFs or
119 : : * applications) at the device level.
120 : : *
121 : : * The application should match traffic originating from precise
122 : : * locations. See items PORT_REPRESENTOR and REPRESENTED_PORT.
123 : : *
124 : : * Managing "transfer" flows requires that the user communicate them
125 : : * through a suitable port. @see rte_flow_pick_transfer_proxy().
126 : : */
127 : : uint32_t transfer:1;
128 : : uint32_t reserved:29; /**< Reserved, must be zero. */
129 : : };
130 : :
131 : : struct rte_flow_group_attr {
132 : : uint32_t ingress:1;
133 : : uint32_t egress:1;
134 : : uint32_t transfer:1;
135 : : };
136 : :
137 : : /**
138 : : * Matching pattern item types.
139 : : *
140 : : * Pattern items fall in two categories:
141 : : *
142 : : * - Matching protocol headers and packet data, usually associated with a
143 : : * specification structure. These must be stacked in the same order as the
144 : : * protocol layers to match inside packets, starting from the lowest.
145 : : *
146 : : * - Matching meta-data or affecting pattern processing, often without a
147 : : * specification structure. Since they do not match packet contents, their
148 : : * position in the list is usually not relevant.
149 : : *
150 : : * See the description of individual types for more information. Those
151 : : * marked with [META] fall into the second category.
152 : : */
153 : : enum rte_flow_item_type {
154 : : /**
155 : : * [META]
156 : : *
157 : : * End marker for item lists. Prevents further processing of items,
158 : : * thereby ending the pattern.
159 : : *
160 : : * No associated specification structure.
161 : : */
162 : : RTE_FLOW_ITEM_TYPE_END,
163 : :
164 : : /**
165 : : * [META]
166 : : *
167 : : * Used as a placeholder for convenience. It is ignored and simply
168 : : * discarded by PMDs.
169 : : *
170 : : * No associated specification structure.
171 : : */
172 : : RTE_FLOW_ITEM_TYPE_VOID,
173 : :
174 : : /**
175 : : * [META]
176 : : *
177 : : * Inverted matching, i.e. process packets that do not match the
178 : : * pattern.
179 : : *
180 : : * No associated specification structure.
181 : : */
182 : : RTE_FLOW_ITEM_TYPE_INVERT,
183 : :
184 : : /**
185 : : * Matches any protocol in place of the current layer, a single ANY
186 : : * may also stand for several protocol layers.
187 : : *
188 : : * See struct rte_flow_item_any.
189 : : */
190 : : RTE_FLOW_ITEM_TYPE_ANY,
191 : :
192 : : /**
193 : : * @deprecated
194 : : * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
195 : : * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
196 : : *
197 : : * [META]
198 : : *
199 : : * Matches traffic originating from (ingress) or going to (egress) a
200 : : * given DPDK port ID.
201 : : *
202 : : * See struct rte_flow_item_port_id.
203 : : */
204 : : RTE_FLOW_ITEM_TYPE_PORT_ID,
205 : :
206 : : /**
207 : : * Matches a byte string of a given length at a given offset.
208 : : *
209 : : * See struct rte_flow_item_raw.
210 : : */
211 : : RTE_FLOW_ITEM_TYPE_RAW,
212 : :
213 : : /**
214 : : * Matches an Ethernet header.
215 : : *
216 : : * See struct rte_flow_item_eth.
217 : : */
218 : : RTE_FLOW_ITEM_TYPE_ETH,
219 : :
220 : : /**
221 : : * Matches an 802.1Q/ad VLAN tag.
222 : : *
223 : : * See struct rte_flow_item_vlan.
224 : : */
225 : : RTE_FLOW_ITEM_TYPE_VLAN,
226 : :
227 : : /**
228 : : * Matches an IPv4 header.
229 : : *
230 : : * See struct rte_flow_item_ipv4.
231 : : */
232 : : RTE_FLOW_ITEM_TYPE_IPV4,
233 : :
234 : : /**
235 : : * Matches an IPv6 header.
236 : : *
237 : : * See struct rte_flow_item_ipv6.
238 : : */
239 : : RTE_FLOW_ITEM_TYPE_IPV6,
240 : :
241 : : /**
242 : : * Matches an ICMP header.
243 : : *
244 : : * See struct rte_flow_item_icmp.
245 : : */
246 : : RTE_FLOW_ITEM_TYPE_ICMP,
247 : :
248 : : /**
249 : : * Matches a UDP header.
250 : : *
251 : : * See struct rte_flow_item_udp.
252 : : */
253 : : RTE_FLOW_ITEM_TYPE_UDP,
254 : :
255 : : /**
256 : : * Matches a TCP header.
257 : : *
258 : : * See struct rte_flow_item_tcp.
259 : : */
260 : : RTE_FLOW_ITEM_TYPE_TCP,
261 : :
262 : : /**
263 : : * Matches a SCTP header.
264 : : *
265 : : * See struct rte_flow_item_sctp.
266 : : */
267 : : RTE_FLOW_ITEM_TYPE_SCTP,
268 : :
269 : : /**
270 : : * Matches a VXLAN header.
271 : : *
272 : : * See struct rte_flow_item_vxlan.
273 : : */
274 : : RTE_FLOW_ITEM_TYPE_VXLAN,
275 : :
276 : : /**
277 : : * Matches a E_TAG header.
278 : : *
279 : : * See struct rte_flow_item_e_tag.
280 : : */
281 : : RTE_FLOW_ITEM_TYPE_E_TAG,
282 : :
283 : : /**
284 : : * Matches a NVGRE header.
285 : : *
286 : : * See struct rte_flow_item_nvgre.
287 : : */
288 : : RTE_FLOW_ITEM_TYPE_NVGRE,
289 : :
290 : : /**
291 : : * Matches a MPLS header.
292 : : *
293 : : * See struct rte_flow_item_mpls.
294 : : */
295 : : RTE_FLOW_ITEM_TYPE_MPLS,
296 : :
297 : : /**
298 : : * Matches a GRE header.
299 : : *
300 : : * See struct rte_flow_item_gre.
301 : : */
302 : : RTE_FLOW_ITEM_TYPE_GRE,
303 : :
304 : : /**
305 : : * [META]
306 : : *
307 : : * Fuzzy pattern match, expect faster than default.
308 : : *
309 : : * This is for device that support fuzzy matching option.
310 : : * Usually a fuzzy matching is fast but the cost is accuracy.
311 : : *
312 : : * See struct rte_flow_item_fuzzy.
313 : : */
314 : : RTE_FLOW_ITEM_TYPE_FUZZY,
315 : :
316 : : /**
317 : : * Matches a GTP header.
318 : : *
319 : : * Configure flow for GTP packets.
320 : : *
321 : : * See struct rte_flow_item_gtp.
322 : : */
323 : : RTE_FLOW_ITEM_TYPE_GTP,
324 : :
325 : : /**
326 : : * Matches a GTP header.
327 : : *
328 : : * Configure flow for GTP-C packets.
329 : : *
330 : : * See struct rte_flow_item_gtp.
331 : : */
332 : : RTE_FLOW_ITEM_TYPE_GTPC,
333 : :
334 : : /**
335 : : * Matches a GTP header.
336 : : *
337 : : * Configure flow for GTP-U packets.
338 : : *
339 : : * See struct rte_flow_item_gtp.
340 : : */
341 : : RTE_FLOW_ITEM_TYPE_GTPU,
342 : :
343 : : /**
344 : : * Matches a ESP header.
345 : : *
346 : : * See struct rte_flow_item_esp.
347 : : */
348 : : RTE_FLOW_ITEM_TYPE_ESP,
349 : :
350 : : /**
351 : : * Matches a GENEVE header.
352 : : *
353 : : * See struct rte_flow_item_geneve.
354 : : */
355 : : RTE_FLOW_ITEM_TYPE_GENEVE,
356 : :
357 : : /**
358 : : * Matches a VXLAN-GPE header.
359 : : *
360 : : * See struct rte_flow_item_vxlan_gpe.
361 : : */
362 : : RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
363 : :
364 : : /**
365 : : * Matches an ARP header for Ethernet/IPv4.
366 : : *
367 : : * See struct rte_flow_item_arp_eth_ipv4.
368 : : */
369 : : RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4,
370 : :
371 : : /**
372 : : * Matches the presence of any IPv6 extension header.
373 : : *
374 : : * See struct rte_flow_item_ipv6_ext.
375 : : */
376 : : RTE_FLOW_ITEM_TYPE_IPV6_EXT,
377 : :
378 : : /**
379 : : * Matches any ICMPv6 header.
380 : : *
381 : : * See struct rte_flow_item_icmp6.
382 : : */
383 : : RTE_FLOW_ITEM_TYPE_ICMP6,
384 : :
385 : : /**
386 : : * Matches an ICMPv6 neighbor discovery solicitation.
387 : : *
388 : : * See struct rte_flow_item_icmp6_nd_ns.
389 : : */
390 : : RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS,
391 : :
392 : : /**
393 : : * Matches an ICMPv6 neighbor discovery advertisement.
394 : : *
395 : : * See struct rte_flow_item_icmp6_nd_na.
396 : : */
397 : : RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA,
398 : :
399 : : /**
400 : : * Matches the presence of any ICMPv6 neighbor discovery option.
401 : : *
402 : : * See struct rte_flow_item_icmp6_nd_opt.
403 : : */
404 : : RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT,
405 : :
406 : : /**
407 : : * Matches an ICMPv6 neighbor discovery source Ethernet link-layer
408 : : * address option.
409 : : *
410 : : * See struct rte_flow_item_icmp6_nd_opt_sla_eth.
411 : : */
412 : : RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH,
413 : :
414 : : /**
415 : : * Matches an ICMPv6 neighbor discovery target Ethernet link-layer
416 : : * address option.
417 : : *
418 : : * See struct rte_flow_item_icmp6_nd_opt_tla_eth.
419 : : */
420 : : RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH,
421 : :
422 : : /**
423 : : * Matches specified mark field.
424 : : *
425 : : * See struct rte_flow_item_mark.
426 : : */
427 : : RTE_FLOW_ITEM_TYPE_MARK,
428 : :
429 : : /**
430 : : * [META]
431 : : *
432 : : * Matches a metadata value.
433 : : *
434 : : * See struct rte_flow_item_meta.
435 : : */
436 : : RTE_FLOW_ITEM_TYPE_META,
437 : :
438 : : /**
439 : : * Matches a GRE optional key field.
440 : : *
441 : : * The value should a big-endian 32bit integer.
442 : : *
443 : : * When this item present the K bit is implicitly matched as "1"
444 : : * in the default mask.
445 : : *
446 : : * @p spec/mask type:
447 : : * @code rte_be32_t * @endcode
448 : : */
449 : : RTE_FLOW_ITEM_TYPE_GRE_KEY,
450 : :
451 : : /**
452 : : * Matches a GTP extension header: PDU session container.
453 : : *
454 : : * Configure flow for GTP packets with extension header type 0x85.
455 : : *
456 : : * See struct rte_flow_item_gtp_psc.
457 : : */
458 : : RTE_FLOW_ITEM_TYPE_GTP_PSC,
459 : :
460 : : /**
461 : : * Matches a PPPoE header.
462 : : *
463 : : * Configure flow for PPPoE session packets.
464 : : *
465 : : * See struct rte_flow_item_pppoe.
466 : : */
467 : : RTE_FLOW_ITEM_TYPE_PPPOES,
468 : :
469 : : /**
470 : : * Matches a PPPoE header.
471 : : *
472 : : * Configure flow for PPPoE discovery packets.
473 : : *
474 : : * See struct rte_flow_item_pppoe.
475 : : */
476 : : RTE_FLOW_ITEM_TYPE_PPPOED,
477 : :
478 : : /**
479 : : * Matches a PPPoE optional proto_id field.
480 : : *
481 : : * It only applies to PPPoE session packets.
482 : : *
483 : : * See struct rte_flow_item_pppoe_proto_id.
484 : : */
485 : : RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID,
486 : :
487 : : /**
488 : : * Matches Network service header (NSH).
489 : : * See struct rte_flow_item_nsh.
490 : : *
491 : : */
492 : : RTE_FLOW_ITEM_TYPE_NSH,
493 : :
494 : : /**
495 : : * Matches Internet Group Management Protocol (IGMP).
496 : : * See struct rte_flow_item_igmp.
497 : : *
498 : : */
499 : : RTE_FLOW_ITEM_TYPE_IGMP,
500 : :
501 : : /**
502 : : * Matches IP Authentication Header (AH).
503 : : * See struct rte_flow_item_ah.
504 : : *
505 : : */
506 : : RTE_FLOW_ITEM_TYPE_AH,
507 : :
508 : : /**
509 : : * Matches a HIGIG header.
510 : : * see struct rte_flow_item_higig2_hdr.
511 : : */
512 : : RTE_FLOW_ITEM_TYPE_HIGIG2,
513 : :
514 : : /**
515 : : * [META]
516 : : *
517 : : * Matches a tag value.
518 : : *
519 : : * See struct rte_flow_item_tag.
520 : : */
521 : : RTE_FLOW_ITEM_TYPE_TAG,
522 : :
523 : : /**
524 : : * Matches a L2TPv3 over IP header.
525 : : *
526 : : * Configure flow for L2TPv3 over IP packets.
527 : : *
528 : : * See struct rte_flow_item_l2tpv3oip.
529 : : */
530 : : RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
531 : :
532 : : /**
533 : : * Matches PFCP Header.
534 : : * See struct rte_flow_item_pfcp.
535 : : *
536 : : */
537 : : RTE_FLOW_ITEM_TYPE_PFCP,
538 : :
539 : : /**
540 : : * Matches eCPRI Header.
541 : : *
542 : : * Configure flow for eCPRI over ETH or UDP packets.
543 : : *
544 : : * See struct rte_flow_item_ecpri.
545 : : */
546 : : RTE_FLOW_ITEM_TYPE_ECPRI,
547 : :
548 : : /**
549 : : * Matches the presence of IPv6 fragment extension header.
550 : : *
551 : : * See struct rte_flow_item_ipv6_frag_ext.
552 : : */
553 : : RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
554 : :
555 : : /**
556 : : * Matches Geneve Variable Length Option
557 : : *
558 : : * See struct rte_flow_item_geneve_opt
559 : : */
560 : : RTE_FLOW_ITEM_TYPE_GENEVE_OPT,
561 : :
562 : : /**
563 : : * [META]
564 : : *
565 : : * Matches on packet integrity.
566 : : * For some devices application needs to enable integration checks in HW
567 : : * before using this item.
568 : : *
569 : : * @see struct rte_flow_item_integrity.
570 : : */
571 : : RTE_FLOW_ITEM_TYPE_INTEGRITY,
572 : :
573 : : /**
574 : : * [META]
575 : : *
576 : : * Matches conntrack state.
577 : : *
578 : : * @see struct rte_flow_item_conntrack.
579 : : */
580 : : RTE_FLOW_ITEM_TYPE_CONNTRACK,
581 : :
582 : : /**
583 : : * [META]
584 : : *
585 : : * Matches traffic entering the embedded switch from the given ethdev.
586 : : *
587 : : * @see struct rte_flow_item_ethdev
588 : : */
589 : : RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
590 : :
591 : : /**
592 : : * [META]
593 : : *
594 : : * Matches traffic entering the embedded switch from
595 : : * the entity represented by the given ethdev.
596 : : *
597 : : * @see struct rte_flow_item_ethdev
598 : : */
599 : : RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT,
600 : :
601 : : /**
602 : : * Matches a configured set of fields at runtime calculated offsets
603 : : * over the generic network header with variable length and
604 : : * flexible pattern
605 : : *
606 : : * @see struct rte_flow_item_flex.
607 : : */
608 : : RTE_FLOW_ITEM_TYPE_FLEX,
609 : :
610 : : /**
611 : : * Matches L2TPv2 Header.
612 : : *
613 : : * See struct rte_flow_item_l2tpv2.
614 : : */
615 : : RTE_FLOW_ITEM_TYPE_L2TPV2,
616 : :
617 : : /**
618 : : * Matches PPP Header.
619 : : *
620 : : * See struct rte_flow_item_ppp.
621 : : */
622 : : RTE_FLOW_ITEM_TYPE_PPP,
623 : :
624 : : /**
625 : : * Matches GRE optional fields.
626 : : *
627 : : * See struct rte_flow_item_gre_opt.
628 : : */
629 : : RTE_FLOW_ITEM_TYPE_GRE_OPTION,
630 : :
631 : : /**
632 : : * Matches MACsec Ethernet Header.
633 : : *
634 : : * See struct rte_flow_item_macsec.
635 : : */
636 : : RTE_FLOW_ITEM_TYPE_MACSEC,
637 : :
638 : : /**
639 : : * Matches Meter Color Marker.
640 : : *
641 : : * See struct rte_flow_item_meter_color.
642 : : */
643 : : RTE_FLOW_ITEM_TYPE_METER_COLOR,
644 : :
645 : : /**
646 : : * Matches the presence of IPv6 routing extension header.
647 : : *
648 : : * @see struct rte_flow_item_ipv6_routing_ext.
649 : : */
650 : : RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT,
651 : :
652 : : /**
653 : : * Matches an ICMPv6 echo request.
654 : : *
655 : : * @see struct rte_flow_item_icmp6_echo.
656 : : */
657 : : RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST,
658 : :
659 : : /**
660 : : * Matches an ICMPv6 echo reply.
661 : : *
662 : : * @see struct rte_flow_item_icmp6_echo.
663 : : */
664 : : RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY,
665 : :
666 : : /**
667 : : * Match Quota state
668 : : *
669 : : * @see struct rte_flow_item_quota
670 : : */
671 : : RTE_FLOW_ITEM_TYPE_QUOTA,
672 : :
673 : : /**
674 : : * Matches on the aggregated port of the received packet.
675 : : * Used in case multiple ports are aggregated to the a DPDK port.
676 : : * First port is number 1.
677 : : *
678 : : * @see struct rte_flow_item_aggr_affinity.
679 : : */
680 : : RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY,
681 : :
682 : : /**
683 : : * Match Tx queue number.
684 : : * This is valid only for egress rules.
685 : : *
686 : : * @see struct rte_flow_item_tx_queue
687 : : */
688 : : RTE_FLOW_ITEM_TYPE_TX_QUEUE,
689 : :
690 : : /**
691 : : * Matches an InfiniBand base transport header in RoCE packet.
692 : : *
693 : : * @see struct rte_flow_item_ib_bth.
694 : : */
695 : : RTE_FLOW_ITEM_TYPE_IB_BTH,
696 : :
697 : : /**
698 : : * Matches the packet type as defined in rte_mbuf_ptype.
699 : : *
700 : : * See struct rte_flow_item_ptype.
701 : : *
702 : : */
703 : : RTE_FLOW_ITEM_TYPE_PTYPE,
704 : :
705 : : /**
706 : : * [META]
707 : : *
708 : : * Matches a random value.
709 : : *
710 : : * This value is not based on the packet data/headers.
711 : : * The application shouldn't assume that this value is kept
712 : : * during the lifetime of the packet.
713 : : *
714 : : * @see struct rte_flow_item_random.
715 : : */
716 : : RTE_FLOW_ITEM_TYPE_RANDOM,
717 : :
718 : : /**
719 : : * Match packet with various comparison types.
720 : : *
721 : : * See struct rte_flow_item_compare.
722 : : */
723 : : RTE_FLOW_ITEM_TYPE_COMPARE,
724 : : };
725 : :
726 : : /**
727 : : * @warning
728 : : * @b EXPERIMENTAL: this API may change without prior notice.
729 : : *
730 : : * QUOTA state.
731 : : *
732 : : * @see struct rte_flow_item_quota
733 : : */
734 : : enum rte_flow_quota_state {
735 : : RTE_FLOW_QUOTA_STATE_PASS, /**< PASS quota state */
736 : : RTE_FLOW_QUOTA_STATE_BLOCK /**< BLOCK quota state */
737 : : };
738 : :
739 : : /**
740 : : * RTE_FLOW_ITEM_TYPE_QUOTA
741 : : *
742 : : * Matches QUOTA state
743 : : */
744 : : struct rte_flow_item_quota {
745 : : enum rte_flow_quota_state state;
746 : : };
747 : :
748 : : /**
749 : : * Default mask for RTE_FLOW_ITEM_TYPE_QUOTA
750 : : */
751 : : #ifndef __cplusplus
752 : : static const struct rte_flow_item_quota rte_flow_item_quota_mask = {
753 : : .state = (enum rte_flow_quota_state)0xff
754 : : };
755 : : #endif
756 : :
757 : : /**
758 : : *
759 : : * RTE_FLOW_ITEM_TYPE_HIGIG2
760 : : * Matches higig2 header
761 : : */
762 : : struct rte_flow_item_higig2_hdr {
763 : : struct rte_higig2_hdr hdr;
764 : : };
765 : :
766 : : /** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
767 : : #ifndef __cplusplus
768 : : static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
769 : : .hdr = {
770 : : .ppt1 = {
771 : : .classification = RTE_BE16(UINT16_MAX),
772 : : .vid = RTE_BE16(0xfff),
773 : : },
774 : : },
775 : : };
776 : : #endif
777 : :
778 : : /**
779 : : * RTE_FLOW_ITEM_TYPE_ANY
780 : : *
781 : : * Matches any protocol in place of the current layer, a single ANY may also
782 : : * stand for several protocol layers.
783 : : *
784 : : * This is usually specified as the first pattern item when looking for a
785 : : * protocol anywhere in a packet.
786 : : *
787 : : * A zeroed mask stands for any number of layers.
788 : : */
789 : : struct rte_flow_item_any {
790 : : uint32_t num; /**< Number of layers covered. */
791 : : };
792 : :
793 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
794 : : #ifndef __cplusplus
795 : : static const struct rte_flow_item_any rte_flow_item_any_mask = {
796 : : .num = 0x00000000,
797 : : };
798 : : #endif
799 : :
800 : : /**
801 : : * @deprecated
802 : : * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
803 : : * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
804 : : *
805 : : * RTE_FLOW_ITEM_TYPE_PORT_ID
806 : : *
807 : : * Matches traffic originating from (ingress) or going to (egress) a given
808 : : * DPDK port ID.
809 : : *
810 : : * Normally only supported if the port ID in question is known by the
811 : : * underlying PMD and related to the device the flow rule is created
812 : : * against.
813 : : */
814 : : struct rte_flow_item_port_id {
815 : : uint32_t id; /**< DPDK port ID. */
816 : : };
817 : :
818 : : /** Default mask for RTE_FLOW_ITEM_TYPE_PORT_ID. */
819 : : #ifndef __cplusplus
820 : : static const struct rte_flow_item_port_id rte_flow_item_port_id_mask = {
821 : : .id = 0xffffffff,
822 : : };
823 : : #endif
824 : :
825 : : /**
826 : : * RTE_FLOW_ITEM_TYPE_RAW
827 : : *
828 : : * Matches a byte string of a given length at a given offset.
829 : : *
830 : : * Offset is either absolute (using the start of the packet) or relative to
831 : : * the end of the previous matched item in the stack, in which case negative
832 : : * values are allowed.
833 : : *
834 : : * If search is enabled, offset is used as the starting point. The search
835 : : * area can be delimited by setting limit to a nonzero value, which is the
836 : : * maximum number of bytes after offset where the pattern may start.
837 : : *
838 : : * Matching a zero-length pattern is allowed, doing so resets the relative
839 : : * offset for subsequent items.
840 : : *
841 : : * This type does not support ranges (struct rte_flow_item.last).
842 : : */
843 : : struct rte_flow_item_raw {
844 : : uint32_t relative:1; /**< Look for pattern after the previous item. */
845 : : uint32_t search:1; /**< Search pattern from offset (see also limit). */
846 : : uint32_t reserved:30; /**< Reserved, must be set to zero. */
847 : : int32_t offset; /**< Absolute or relative offset for pattern. */
848 : : uint16_t limit; /**< Search area limit for start of pattern. */
849 : : uint16_t length; /**< Pattern length. */
850 : : const uint8_t *pattern; /**< Byte string to look for. */
851 : : };
852 : :
853 : : /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
854 : : #ifndef __cplusplus
855 : : static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
856 : : .relative = 1,
857 : : .search = 1,
858 : : .reserved = 0x3fffffff,
859 : : .offset = 0xffffffff,
860 : : .limit = 0xffff,
861 : : .length = 0xffff,
862 : : .pattern = NULL,
863 : : };
864 : : #endif
865 : :
866 : : /**
867 : : * RTE_FLOW_ITEM_TYPE_ETH
868 : : *
869 : : * Matches an Ethernet header.
870 : : *
871 : : * Inside @p hdr field, the sub-field @p ether_type stands either for EtherType
872 : : * or TPID, depending on whether the item is followed by a VLAN item or not. If
873 : : * two VLAN items follow, the sub-field refers to the outer one, which, in turn,
874 : : * contains the inner TPID in the similar header field. The innermost VLAN item
875 : : * contains a layer-3 EtherType. All of that follows the order seen on the wire.
876 : : *
877 : : * If the field in question contains a TPID value, only tagged packets with the
878 : : * specified TPID will match the pattern. Alternatively, it's possible to match
879 : : * any type of tagged packets by means of the field @p has_vlan rather than use
880 : : * the EtherType/TPID field. Also, it's possible to leave the two fields unused.
881 : : * If this is the case, both tagged and untagged packets will match the pattern.
882 : : */
883 : : struct rte_flow_item_eth {
884 : : union {
885 : : struct {
886 : : /*
887 : : * These fields are retained for compatibility.
888 : : * Please switch to the new header field below.
889 : : */
890 : : struct rte_ether_addr dst; /**< Destination MAC. */
891 : : struct rte_ether_addr src; /**< Source MAC. */
892 : : rte_be16_t type; /**< EtherType or TPID. */
893 : : };
894 : : struct rte_ether_hdr hdr;
895 : : };
896 : : uint32_t has_vlan:1; /**< Packet header contains at least one VLAN. */
897 : : uint32_t reserved:31; /**< Reserved, must be zero. */
898 : : };
899 : :
900 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
901 : : #ifndef __cplusplus
902 : : static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
903 : : .hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
904 : : .hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
905 : : .hdr.ether_type = RTE_BE16(0x0000),
906 : : };
907 : : #endif
908 : :
909 : : /**
910 : : * RTE_FLOW_ITEM_TYPE_VLAN
911 : : *
912 : : * Matches an 802.1Q/ad VLAN tag.
913 : : *
914 : : * The corresponding standard outer EtherType (TPID) values are
915 : : * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by
916 : : * the preceding pattern item.
917 : : * If a @p VLAN item is present in the pattern, then only tagged packets will
918 : : * match the pattern.
919 : : * The field @p has_more_vlan can be used to match any type of tagged packets,
920 : : * instead of using the @p eth_proto field of @p hdr.
921 : : * If the @p eth_proto of @p hdr and @p has_more_vlan fields are not specified,
922 : : * then any tagged packets will match the pattern.
923 : : */
924 : : struct rte_flow_item_vlan {
925 : : union {
926 : : struct {
927 : : /*
928 : : * These fields are retained for compatibility.
929 : : * Please switch to the new header field below.
930 : : */
931 : : rte_be16_t tci; /**< Tag control information. */
932 : : rte_be16_t inner_type; /**< Inner EtherType or TPID. */
933 : : };
934 : : struct rte_vlan_hdr hdr;
935 : : };
936 : : /** Packet header contains at least one more VLAN, after this VLAN. */
937 : : uint32_t has_more_vlan:1;
938 : : uint32_t reserved:31; /**< Reserved, must be zero. */
939 : : };
940 : :
941 : : /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
942 : : #ifndef __cplusplus
943 : : static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
944 : : .hdr.vlan_tci = RTE_BE16(0x0fff),
945 : : .hdr.eth_proto = RTE_BE16(0x0000),
946 : : };
947 : : #endif
948 : :
949 : : /**
950 : : * RTE_FLOW_ITEM_TYPE_IPV4
951 : : *
952 : : * Matches an IPv4 header.
953 : : *
954 : : * Note: IPv4 options are handled by dedicated pattern items.
955 : : */
956 : : struct rte_flow_item_ipv4 {
957 : : struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */
958 : : };
959 : :
960 : : /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
961 : : #ifndef __cplusplus
962 : : static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
963 : : .hdr = {
964 : : .src_addr = RTE_BE32(0xffffffff),
965 : : .dst_addr = RTE_BE32(0xffffffff),
966 : : },
967 : : };
968 : : #endif
969 : :
970 : : /**
971 : : * RTE_FLOW_ITEM_TYPE_IPV6.
972 : : *
973 : : * Matches an IPv6 header.
974 : : *
975 : : * Dedicated flags indicate if header contains specific extension headers.
976 : : */
977 : : struct rte_flow_item_ipv6 {
978 : : struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
979 : : /** Header contains Hop-by-Hop Options extension header. */
980 : : uint32_t has_hop_ext:1;
981 : : /** Header contains Routing extension header. */
982 : : uint32_t has_route_ext:1;
983 : : /** Header contains Fragment extension header. */
984 : : uint32_t has_frag_ext:1;
985 : : /** Header contains Authentication extension header. */
986 : : uint32_t has_auth_ext:1;
987 : : /** Header contains Encapsulation Security Payload extension header. */
988 : : uint32_t has_esp_ext:1;
989 : : /** Header contains Destination Options extension header. */
990 : : uint32_t has_dest_ext:1;
991 : : /** Header contains Mobility extension header. */
992 : : uint32_t has_mobil_ext:1;
993 : : /** Header contains Host Identity Protocol extension header. */
994 : : uint32_t has_hip_ext:1;
995 : : /** Header contains Shim6 Protocol extension header. */
996 : : uint32_t has_shim6_ext:1;
997 : : /** Reserved for future extension headers, must be zero. */
998 : : uint32_t reserved:23;
999 : : };
1000 : :
1001 : : /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
1002 : : #ifndef __cplusplus
1003 : : static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
1004 : : .hdr = {
1005 : : .src_addr =
1006 : : "\xff\xff\xff\xff\xff\xff\xff\xff"
1007 : : "\xff\xff\xff\xff\xff\xff\xff\xff",
1008 : : .dst_addr =
1009 : : "\xff\xff\xff\xff\xff\xff\xff\xff"
1010 : : "\xff\xff\xff\xff\xff\xff\xff\xff",
1011 : : },
1012 : : };
1013 : : #endif
1014 : :
1015 : : /**
1016 : : * @warning
1017 : : * @b EXPERIMENTAL: this structure may change without prior notice.
1018 : : *
1019 : : * RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT.
1020 : : *
1021 : : * Matches an IPv6 routing extension header.
1022 : : */
1023 : : struct rte_flow_item_ipv6_routing_ext {
1024 : : struct rte_ipv6_routing_ext hdr;
1025 : : };
1026 : :
1027 : : /**
1028 : : * RTE_FLOW_ITEM_TYPE_ICMP.
1029 : : *
1030 : : * Matches an ICMP header.
1031 : : */
1032 : : struct rte_flow_item_icmp {
1033 : : struct rte_icmp_hdr hdr; /**< ICMP header definition. */
1034 : : };
1035 : :
1036 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
1037 : : #ifndef __cplusplus
1038 : : static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
1039 : : .hdr = {
1040 : : .icmp_type = 0xff,
1041 : : .icmp_code = 0xff,
1042 : : },
1043 : : };
1044 : : #endif
1045 : :
1046 : : /**
1047 : : * RTE_FLOW_ITEM_TYPE_UDP.
1048 : : *
1049 : : * Matches a UDP header.
1050 : : */
1051 : : struct rte_flow_item_udp {
1052 : : struct rte_udp_hdr hdr; /**< UDP header definition. */
1053 : : };
1054 : :
1055 : : /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
1056 : : #ifndef __cplusplus
1057 : : static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
1058 : : .hdr = {
1059 : : .src_port = RTE_BE16(0xffff),
1060 : : .dst_port = RTE_BE16(0xffff),
1061 : : },
1062 : : };
1063 : : #endif
1064 : :
1065 : : /**
1066 : : * RTE_FLOW_ITEM_TYPE_TCP.
1067 : : *
1068 : : * Matches a TCP header.
1069 : : */
1070 : : struct rte_flow_item_tcp {
1071 : : struct rte_tcp_hdr hdr; /**< TCP header definition. */
1072 : : };
1073 : :
1074 : : /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
1075 : : #ifndef __cplusplus
1076 : : static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
1077 : : .hdr = {
1078 : : .src_port = RTE_BE16(0xffff),
1079 : : .dst_port = RTE_BE16(0xffff),
1080 : : },
1081 : : };
1082 : : #endif
1083 : :
1084 : : /**
1085 : : * RTE_FLOW_ITEM_TYPE_SCTP.
1086 : : *
1087 : : * Matches a SCTP header.
1088 : : */
1089 : : struct rte_flow_item_sctp {
1090 : : struct rte_sctp_hdr hdr; /**< SCTP header definition. */
1091 : : };
1092 : :
1093 : : /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
1094 : : #ifndef __cplusplus
1095 : : static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
1096 : : .hdr = {
1097 : : .src_port = RTE_BE16(0xffff),
1098 : : .dst_port = RTE_BE16(0xffff),
1099 : : },
1100 : : };
1101 : : #endif
1102 : :
1103 : : /**
1104 : : * RTE_FLOW_ITEM_TYPE_VXLAN.
1105 : : *
1106 : : * Matches a VXLAN header (RFC 7348).
1107 : : */
1108 : : struct rte_flow_item_vxlan {
1109 : : union {
1110 : : struct {
1111 : : /*
1112 : : * These fields are retained for compatibility.
1113 : : * Please switch to the new header field below.
1114 : : */
1115 : : uint8_t flags; /**< Normally 0x08 (I flag). */
1116 : : uint8_t rsvd0[3]; /**< Reserved, normally 0x000000. */
1117 : : uint8_t vni[3]; /**< VXLAN identifier. */
1118 : : uint8_t rsvd1; /**< Reserved, normally 0x00. */
1119 : : };
1120 : : struct rte_vxlan_hdr hdr;
1121 : : };
1122 : : };
1123 : :
1124 : : /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
1125 : : #ifndef __cplusplus
1126 : : static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
1127 : : .hdr.vni = "\xff\xff\xff",
1128 : : };
1129 : : #endif
1130 : :
1131 : : /**
1132 : : * RTE_FLOW_ITEM_TYPE_E_TAG.
1133 : : *
1134 : : * Matches a E-tag header.
1135 : : *
1136 : : * The corresponding standard outer EtherType (TPID) value is
1137 : : * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item.
1138 : : */
1139 : : struct rte_flow_item_e_tag {
1140 : : /**
1141 : : * E-Tag control information (E-TCI).
1142 : : * E-PCP (3b), E-DEI (1b), ingress E-CID base (12b).
1143 : : */
1144 : : rte_be16_t epcp_edei_in_ecid_b;
1145 : : /** Reserved (2b), GRP (2b), E-CID base (12b). */
1146 : : rte_be16_t rsvd_grp_ecid_b;
1147 : : uint8_t in_ecid_e; /**< Ingress E-CID ext. */
1148 : : uint8_t ecid_e; /**< E-CID ext. */
1149 : : rte_be16_t inner_type; /**< Inner EtherType or TPID. */
1150 : : };
1151 : :
1152 : : /** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */
1153 : : #ifndef __cplusplus
1154 : : static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = {
1155 : : .rsvd_grp_ecid_b = RTE_BE16(0x3fff),
1156 : : };
1157 : : #endif
1158 : :
1159 : : /**
1160 : : * RTE_FLOW_ITEM_TYPE_NVGRE.
1161 : : *
1162 : : * Matches a NVGRE header.
1163 : : */
1164 : : struct rte_flow_item_nvgre {
1165 : : /**
1166 : : * Checksum (1b), undefined (1b), key bit (1b), sequence number (1b),
1167 : : * reserved 0 (9b), version (3b).
1168 : : *
1169 : : * c_k_s_rsvd0_ver must have value 0x2000 according to RFC 7637.
1170 : : */
1171 : : rte_be16_t c_k_s_rsvd0_ver;
1172 : : rte_be16_t protocol; /**< Protocol type (0x6558). */
1173 : : uint8_t tni[3]; /**< Virtual subnet ID. */
1174 : : uint8_t flow_id; /**< Flow ID. */
1175 : : };
1176 : :
1177 : : /** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */
1178 : : #ifndef __cplusplus
1179 : : static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = {
1180 : : .tni = "\xff\xff\xff",
1181 : : };
1182 : : #endif
1183 : :
1184 : : /**
1185 : : * RTE_FLOW_ITEM_TYPE_MPLS.
1186 : : *
1187 : : * Matches a MPLS header.
1188 : : */
1189 : : struct rte_flow_item_mpls {
1190 : : /**
1191 : : * Label (20b), TC (3b), Bottom of Stack (1b).
1192 : : */
1193 : : uint8_t label_tc_s[3];
1194 : : uint8_t ttl; /** Time-to-Live. */
1195 : : };
1196 : :
1197 : : /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
1198 : : #ifndef __cplusplus
1199 : : static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
1200 : : .label_tc_s = "\xff\xff\xf0",
1201 : : };
1202 : : #endif
1203 : :
1204 : : /**
1205 : : * RTE_FLOW_ITEM_TYPE_GRE.
1206 : : *
1207 : : * Matches a GRE header.
1208 : : */
1209 : : struct rte_flow_item_gre {
1210 : : /**
1211 : : * Checksum (1b), reserved 0 (12b), version (3b).
1212 : : * Refer to RFC 2784.
1213 : : */
1214 : : rte_be16_t c_rsvd0_ver;
1215 : : rte_be16_t protocol; /**< Protocol type. */
1216 : : };
1217 : :
1218 : : /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
1219 : : #ifndef __cplusplus
1220 : : static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
1221 : : .protocol = RTE_BE16(0xffff),
1222 : : };
1223 : : #endif
1224 : :
1225 : : /**
1226 : : * RTE_FLOW_ITEM_TYPE_GRE_OPTION.
1227 : : *
1228 : : * Matches GRE optional fields in header.
1229 : : */
1230 : : struct rte_flow_item_gre_opt {
1231 : : struct rte_gre_hdr_opt_checksum_rsvd checksum_rsvd;
1232 : : struct rte_gre_hdr_opt_key key;
1233 : : struct rte_gre_hdr_opt_sequence sequence;
1234 : : };
1235 : :
1236 : : /**
1237 : : * RTE_FLOW_ITEM_TYPE_MACSEC.
1238 : : *
1239 : : * Matches MACsec header.
1240 : : */
1241 : : struct rte_flow_item_macsec {
1242 : : struct rte_macsec_hdr macsec_hdr;
1243 : : };
1244 : :
1245 : : /**
1246 : : * RTE_FLOW_ITEM_TYPE_FUZZY
1247 : : *
1248 : : * Fuzzy pattern match, expect faster than default.
1249 : : *
1250 : : * This is for device that support fuzzy match option.
1251 : : * Usually a fuzzy match is fast but the cost is accuracy.
1252 : : * i.e. Signature Match only match pattern's hash value, but it is
1253 : : * possible two different patterns have the same hash value.
1254 : : *
1255 : : * Matching accuracy level can be configure by threshold.
1256 : : * Driver can divide the range of threshold and map to different
1257 : : * accuracy levels that device support.
1258 : : *
1259 : : * Threshold 0 means perfect match (no fuzziness), while threshold
1260 : : * 0xffffffff means fuzziest match.
1261 : : */
1262 : : struct rte_flow_item_fuzzy {
1263 : : uint32_t thresh; /**< Accuracy threshold. */
1264 : : };
1265 : :
1266 : : /** Default mask for RTE_FLOW_ITEM_TYPE_FUZZY. */
1267 : : #ifndef __cplusplus
1268 : : static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask = {
1269 : : .thresh = 0xffffffff,
1270 : : };
1271 : : #endif
1272 : :
1273 : : /**
1274 : : * RTE_FLOW_ITEM_TYPE_GTP.
1275 : : *
1276 : : * Matches a GTPv1 header.
1277 : : */
1278 : : struct rte_flow_item_gtp {
1279 : : union {
1280 : : struct {
1281 : : /*
1282 : : * These are old fields kept for compatibility.
1283 : : * Please prefer hdr field below.
1284 : : */
1285 : : /**
1286 : : * Version (3b), protocol type (1b), reserved (1b),
1287 : : * Extension header flag (1b),
1288 : : * Sequence number flag (1b),
1289 : : * N-PDU number flag (1b).
1290 : : */
1291 : : uint8_t v_pt_rsv_flags;
1292 : : uint8_t msg_type; /**< Message type. */
1293 : : rte_be16_t msg_len; /**< Message length. */
1294 : : rte_be32_t teid; /**< Tunnel endpoint identifier. */
1295 : : };
1296 : : struct rte_gtp_hdr hdr; /**< GTP header definition. */
1297 : : };
1298 : : };
1299 : :
1300 : : /** Default mask for RTE_FLOW_ITEM_TYPE_GTP. */
1301 : : #ifndef __cplusplus
1302 : : static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = {
1303 : : .hdr.teid = RTE_BE32(UINT32_MAX),
1304 : : };
1305 : : #endif
1306 : :
1307 : : /**
1308 : : * RTE_FLOW_ITEM_TYPE_ESP
1309 : : *
1310 : : * Matches an ESP header.
1311 : : */
1312 : : struct rte_flow_item_esp {
1313 : : struct rte_esp_hdr hdr; /**< ESP header definition. */
1314 : : };
1315 : :
1316 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */
1317 : : #ifndef __cplusplus
1318 : : static const struct rte_flow_item_esp rte_flow_item_esp_mask = {
1319 : : .hdr = {
1320 : : .spi = RTE_BE32(0xffffffff),
1321 : : },
1322 : : };
1323 : : #endif
1324 : :
1325 : : /**
1326 : : * RTE_FLOW_ITEM_TYPE_GENEVE.
1327 : : *
1328 : : * Matches a GENEVE header.
1329 : : */
1330 : : struct rte_flow_item_geneve {
1331 : : /**
1332 : : * Version (2b), length of the options fields (6b), OAM packet (1b),
1333 : : * critical options present (1b), reserved 0 (6b).
1334 : : */
1335 : : rte_be16_t ver_opt_len_o_c_rsvd0;
1336 : : rte_be16_t protocol; /**< Protocol type. */
1337 : : uint8_t vni[3]; /**< Virtual Network Identifier. */
1338 : : uint8_t rsvd1; /**< Reserved, normally 0x00. */
1339 : : };
1340 : :
1341 : : /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */
1342 : : #ifndef __cplusplus
1343 : : static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
1344 : : .vni = "\xff\xff\xff",
1345 : : };
1346 : : #endif
1347 : :
1348 : : /**
1349 : : * RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05).
1350 : : *
1351 : : * Matches a VXLAN-GPE header.
1352 : : */
1353 : : struct rte_flow_item_vxlan_gpe {
1354 : : union {
1355 : : struct {
1356 : : /*
1357 : : * These are old fields kept for compatibility.
1358 : : * Please prefer hdr field below.
1359 : : */
1360 : : uint8_t flags; /**< Normally 0x0c (I and P flags). */
1361 : : uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */
1362 : : uint8_t protocol; /**< Protocol type. */
1363 : : uint8_t vni[3]; /**< VXLAN identifier. */
1364 : : uint8_t rsvd1; /**< Reserved, normally 0x00. */
1365 : : };
1366 : : struct rte_vxlan_gpe_hdr hdr;
1367 : : };
1368 : : };
1369 : :
1370 : : /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
1371 : : #ifndef __cplusplus
1372 : : static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
1373 : : .hdr.vni = "\xff\xff\xff",
1374 : : };
1375 : : #endif
1376 : :
1377 : : /**
1378 : : * RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4
1379 : : *
1380 : : * Matches an ARP header for Ethernet/IPv4.
1381 : : */
1382 : : struct rte_flow_item_arp_eth_ipv4 {
1383 : : union {
1384 : : struct {
1385 : : /*
1386 : : * These are old fields kept for compatibility.
1387 : : * Please prefer hdr field below.
1388 : : */
1389 : : rte_be16_t hrd; /**< Hardware type, normally 1. */
1390 : : rte_be16_t pro; /**< Protocol type, normally 0x0800. */
1391 : : uint8_t hln; /**< Hardware address length, normally 6. */
1392 : : uint8_t pln; /**< Protocol address length, normally 4. */
1393 : : rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */
1394 : : struct rte_ether_addr sha; /**< Sender hardware address. */
1395 : : rte_be32_t spa; /**< Sender IPv4 address. */
1396 : : struct rte_ether_addr tha; /**< Target hardware address. */
1397 : : rte_be32_t tpa; /**< Target IPv4 address. */
1398 : : };
1399 : : struct rte_arp_hdr hdr; /**< ARP header definition. */
1400 : : };
1401 : : };
1402 : :
1403 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4. */
1404 : : #ifndef __cplusplus
1405 : : static const struct rte_flow_item_arp_eth_ipv4
1406 : : rte_flow_item_arp_eth_ipv4_mask = {
1407 : : .hdr.arp_data.arp_sha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1408 : : .hdr.arp_data.arp_sip = RTE_BE32(UINT32_MAX),
1409 : : .hdr.arp_data.arp_tha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1410 : : .hdr.arp_data.arp_tip = RTE_BE32(UINT32_MAX),
1411 : : };
1412 : : #endif
1413 : :
1414 : : /**
1415 : : * RTE_FLOW_ITEM_TYPE_IPV6_EXT
1416 : : *
1417 : : * Matches the presence of any IPv6 extension header.
1418 : : *
1419 : : * Normally preceded by any of:
1420 : : *
1421 : : * - RTE_FLOW_ITEM_TYPE_IPV6
1422 : : * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
1423 : : */
1424 : : struct rte_flow_item_ipv6_ext {
1425 : : uint8_t next_hdr; /**< Next header. */
1426 : : };
1427 : :
1428 : : /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6_EXT. */
1429 : : #ifndef __cplusplus
1430 : : static const
1431 : : struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
1432 : : .next_hdr = 0xff,
1433 : : };
1434 : : #endif
1435 : :
1436 : : /**
1437 : : * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
1438 : : *
1439 : : * Matches the presence of IPv6 fragment extension header.
1440 : : *
1441 : : * Preceded by any of:
1442 : : *
1443 : : * - RTE_FLOW_ITEM_TYPE_IPV6
1444 : : * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
1445 : : */
1446 : : struct rte_flow_item_ipv6_frag_ext {
1447 : : struct rte_ipv6_fragment_ext hdr;
1448 : : };
1449 : :
1450 : : /**
1451 : : * RTE_FLOW_ITEM_TYPE_ICMP6
1452 : : *
1453 : : * Matches any ICMPv6 header.
1454 : : */
1455 : : struct rte_flow_item_icmp6 {
1456 : : uint8_t type; /**< ICMPv6 type. */
1457 : : uint8_t code; /**< ICMPv6 code. */
1458 : : uint16_t checksum; /**< ICMPv6 checksum. */
1459 : : };
1460 : :
1461 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6. */
1462 : : #ifndef __cplusplus
1463 : : static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask = {
1464 : : .type = 0xff,
1465 : : .code = 0xff,
1466 : : };
1467 : : #endif
1468 : :
1469 : : /**
1470 : : * RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REQUEST
1471 : : * RTE_FLOW_ITEM_TYPE_ICMP6_ECHO_REPLY
1472 : : *
1473 : : * Matches an ICMPv6 echo request or reply.
1474 : : */
1475 : : struct rte_flow_item_icmp6_echo {
1476 : : struct rte_icmp_echo_hdr hdr;
1477 : : };
1478 : :
1479 : : /**
1480 : : * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1481 : : *
1482 : : * Matches an ICMPv6 neighbor discovery solicitation.
1483 : : */
1484 : : struct rte_flow_item_icmp6_nd_ns {
1485 : : uint8_t type; /**< ICMPv6 type, normally 135. */
1486 : : uint8_t code; /**< ICMPv6 code, normally 0. */
1487 : : rte_be16_t checksum; /**< ICMPv6 checksum. */
1488 : : rte_be32_t reserved; /**< Reserved, normally 0. */
1489 : : uint8_t target_addr[16]; /**< Target address. */
1490 : : };
1491 : :
1492 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS. */
1493 : : #ifndef __cplusplus
1494 : : static const
1495 : : struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask = {
1496 : : .target_addr =
1497 : : "\xff\xff\xff\xff\xff\xff\xff\xff"
1498 : : "\xff\xff\xff\xff\xff\xff\xff\xff",
1499 : : };
1500 : : #endif
1501 : :
1502 : : /**
1503 : : * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1504 : : *
1505 : : * Matches an ICMPv6 neighbor discovery advertisement.
1506 : : */
1507 : : struct rte_flow_item_icmp6_nd_na {
1508 : : uint8_t type; /**< ICMPv6 type, normally 136. */
1509 : : uint8_t code; /**< ICMPv6 code, normally 0. */
1510 : : rte_be16_t checksum; /**< ICMPv6 checksum. */
1511 : : /**
1512 : : * Route flag (1b), solicited flag (1b), override flag (1b),
1513 : : * reserved (29b).
1514 : : */
1515 : : rte_be32_t rso_reserved;
1516 : : uint8_t target_addr[16]; /**< Target address. */
1517 : : };
1518 : :
1519 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA. */
1520 : : #ifndef __cplusplus
1521 : : static const
1522 : : struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask = {
1523 : : .target_addr =
1524 : : "\xff\xff\xff\xff\xff\xff\xff\xff"
1525 : : "\xff\xff\xff\xff\xff\xff\xff\xff",
1526 : : };
1527 : : #endif
1528 : :
1529 : : /**
1530 : : * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1531 : : *
1532 : : * Matches the presence of any ICMPv6 neighbor discovery option.
1533 : : *
1534 : : * Normally preceded by any of:
1535 : : *
1536 : : * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1537 : : * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1538 : : * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1539 : : */
1540 : : struct rte_flow_item_icmp6_nd_opt {
1541 : : uint8_t type; /**< ND option type. */
1542 : : uint8_t length; /**< ND option length. */
1543 : : };
1544 : :
1545 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT. */
1546 : : #ifndef __cplusplus
1547 : : static const struct rte_flow_item_icmp6_nd_opt
1548 : : rte_flow_item_icmp6_nd_opt_mask = {
1549 : : .type = 0xff,
1550 : : };
1551 : : #endif
1552 : :
1553 : : /**
1554 : : * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH
1555 : : *
1556 : : * Matches an ICMPv6 neighbor discovery source Ethernet link-layer address
1557 : : * option.
1558 : : *
1559 : : * Normally preceded by any of:
1560 : : *
1561 : : * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
1562 : : * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1563 : : */
1564 : : struct rte_flow_item_icmp6_nd_opt_sla_eth {
1565 : : uint8_t type; /**< ND option type, normally 1. */
1566 : : uint8_t length; /**< ND option length, normally 1. */
1567 : : struct rte_ether_addr sla; /**< Source Ethernet LLA. */
1568 : : };
1569 : :
1570 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */
1571 : : #ifndef __cplusplus
1572 : : static const struct rte_flow_item_icmp6_nd_opt_sla_eth
1573 : : rte_flow_item_icmp6_nd_opt_sla_eth_mask = {
1574 : : .sla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1575 : : };
1576 : : #endif
1577 : :
1578 : : /**
1579 : : * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH
1580 : : *
1581 : : * Matches an ICMPv6 neighbor discovery target Ethernet link-layer address
1582 : : * option.
1583 : : *
1584 : : * Normally preceded by any of:
1585 : : *
1586 : : * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
1587 : : * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
1588 : : */
1589 : : struct rte_flow_item_icmp6_nd_opt_tla_eth {
1590 : : uint8_t type; /**< ND option type, normally 2. */
1591 : : uint8_t length; /**< ND option length, normally 1. */
1592 : : struct rte_ether_addr tla; /**< Target Ethernet LLA. */
1593 : : };
1594 : :
1595 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */
1596 : : #ifndef __cplusplus
1597 : : static const struct rte_flow_item_icmp6_nd_opt_tla_eth
1598 : : rte_flow_item_icmp6_nd_opt_tla_eth_mask = {
1599 : : .tla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1600 : : };
1601 : : #endif
1602 : :
1603 : : /**
1604 : : * RTE_FLOW_ITEM_TYPE_META
1605 : : *
1606 : : * Matches a specified metadata value. On egress, metadata can be set
1607 : : * either by mbuf dynamic metadata field with RTE_MBUF_DYNFLAG_TX_METADATA flag
1608 : : * or RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META
1609 : : * sets metadata for a packet and the metadata will be reported via mbuf
1610 : : * metadata dynamic field with RTE_MBUF_DYNFLAG_RX_METADATA flag. The dynamic
1611 : : * mbuf field must be registered in advance by
1612 : : * rte_flow_dynf_metadata_register().
1613 : : */
1614 : : struct rte_flow_item_meta {
1615 : : uint32_t data;
1616 : : };
1617 : :
1618 : : /** Default mask for RTE_FLOW_ITEM_TYPE_META. */
1619 : : #ifndef __cplusplus
1620 : : static const struct rte_flow_item_meta rte_flow_item_meta_mask = {
1621 : : .data = UINT32_MAX,
1622 : : };
1623 : : #endif
1624 : :
1625 : : /**
1626 : : * RTE_FLOW_ITEM_TYPE_GTP_PSC.
1627 : : *
1628 : : * Matches a GTP PDU extension header with type 0x85.
1629 : : */
1630 : : struct rte_flow_item_gtp_psc {
1631 : : struct rte_gtp_psc_generic_hdr hdr; /**< gtp psc generic hdr. */
1632 : : };
1633 : :
1634 : : /** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */
1635 : : #ifndef __cplusplus
1636 : : static const struct rte_flow_item_gtp_psc
1637 : : rte_flow_item_gtp_psc_mask = {
1638 : : .hdr.qfi = 0x3f,
1639 : : };
1640 : : #endif
1641 : :
1642 : : /**
1643 : : * RTE_FLOW_ITEM_TYPE_PPPOE.
1644 : : *
1645 : : * Matches a PPPoE header.
1646 : : */
1647 : : struct rte_flow_item_pppoe {
1648 : : /**
1649 : : * Version (4b), type (4b).
1650 : : */
1651 : : uint8_t version_type;
1652 : : uint8_t code; /**< Message type. */
1653 : : rte_be16_t session_id; /**< Session identifier. */
1654 : : rte_be16_t length; /**< Payload length. */
1655 : : };
1656 : :
1657 : : /**
1658 : : * RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID.
1659 : : *
1660 : : * Matches a PPPoE optional proto_id field.
1661 : : *
1662 : : * It only applies to PPPoE session packets.
1663 : : *
1664 : : * Normally preceded by any of:
1665 : : *
1666 : : * - RTE_FLOW_ITEM_TYPE_PPPOE
1667 : : * - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID
1668 : : */
1669 : : struct rte_flow_item_pppoe_proto_id {
1670 : : rte_be16_t proto_id; /**< PPP protocol identifier. */
1671 : : };
1672 : :
1673 : : /** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. */
1674 : : #ifndef __cplusplus
1675 : : static const struct rte_flow_item_pppoe_proto_id
1676 : : rte_flow_item_pppoe_proto_id_mask = {
1677 : : .proto_id = RTE_BE16(0xffff),
1678 : : };
1679 : : #endif
1680 : :
1681 : : /**
1682 : : * @warning
1683 : : * @b EXPERIMENTAL: this structure may change without prior notice
1684 : : *
1685 : : * RTE_FLOW_ITEM_TYPE_TAG
1686 : : *
1687 : : * Matches a specified tag value at the specified index.
1688 : : */
1689 : : struct rte_flow_item_tag {
1690 : : uint32_t data;
1691 : : uint8_t index;
1692 : : };
1693 : :
1694 : : /** Default mask for RTE_FLOW_ITEM_TYPE_TAG. */
1695 : : #ifndef __cplusplus
1696 : : static const struct rte_flow_item_tag rte_flow_item_tag_mask = {
1697 : : .data = 0xffffffff,
1698 : : .index = 0xff,
1699 : : };
1700 : : #endif
1701 : :
1702 : : /**
1703 : : * RTE_FLOW_ITEM_TYPE_L2TPV3OIP.
1704 : : *
1705 : : * Matches a L2TPv3 over IP header.
1706 : : */
1707 : : struct rte_flow_item_l2tpv3oip {
1708 : : rte_be32_t session_id; /**< Session ID. */
1709 : : };
1710 : :
1711 : : /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3OIP. */
1712 : : #ifndef __cplusplus
1713 : : static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask = {
1714 : : .session_id = RTE_BE32(UINT32_MAX),
1715 : : };
1716 : : #endif
1717 : :
1718 : :
1719 : : /**
1720 : : * @warning
1721 : : * @b EXPERIMENTAL: this structure may change without prior notice
1722 : : *
1723 : : * RTE_FLOW_ITEM_TYPE_MARK
1724 : : *
1725 : : * Matches an arbitrary integer value which was set using the ``MARK`` action
1726 : : * in a previously matched rule.
1727 : : *
1728 : : * This item can only be specified once as a match criteria as the ``MARK``
1729 : : * action can only be specified once in a flow action.
1730 : : *
1731 : : * This value is arbitrary and application-defined. Maximum allowed value
1732 : : * depends on the underlying implementation.
1733 : : *
1734 : : * Depending on the underlying implementation the MARK item may be supported on
1735 : : * the physical device, with virtual groups in the PMD or not at all.
1736 : : */
1737 : : struct rte_flow_item_mark {
1738 : : uint32_t id; /**< Integer value to match against. */
1739 : : };
1740 : :
1741 : : /** Default mask for RTE_FLOW_ITEM_TYPE_MARK. */
1742 : : #ifndef __cplusplus
1743 : : static const struct rte_flow_item_mark rte_flow_item_mark_mask = {
1744 : : .id = 0xffffffff,
1745 : : };
1746 : : #endif
1747 : :
1748 : : /**
1749 : : * @warning
1750 : : * @b EXPERIMENTAL: this structure may change without prior notice
1751 : : *
1752 : : * RTE_FLOW_ITEM_TYPE_NSH
1753 : : *
1754 : : * Match network service header (NSH), RFC 8300
1755 : : */
1756 : : struct rte_flow_item_nsh {
1757 : : uint32_t version:2;
1758 : : uint32_t oam_pkt:1;
1759 : : uint32_t reserved:1;
1760 : : uint32_t ttl:6;
1761 : : uint32_t length:6;
1762 : : uint32_t reserved1:4;
1763 : : uint32_t mdtype:4;
1764 : : uint32_t next_proto:8;
1765 : : uint32_t spi:24;
1766 : : uint32_t sindex:8;
1767 : : };
1768 : :
1769 : : /** Default mask for RTE_FLOW_ITEM_TYPE_NSH. */
1770 : : #ifndef __cplusplus
1771 : : static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = {
1772 : : .mdtype = 0xf,
1773 : : .next_proto = 0xff,
1774 : : .spi = 0xffffff,
1775 : : .sindex = 0xff,
1776 : : };
1777 : : #endif
1778 : :
1779 : : /**
1780 : : * @warning
1781 : : * @b EXPERIMENTAL: this structure may change without prior notice
1782 : : *
1783 : : * RTE_FLOW_ITEM_TYPE_IGMP
1784 : : *
1785 : : * Match Internet Group Management Protocol (IGMP), RFC 2236
1786 : : */
1787 : : struct rte_flow_item_igmp {
1788 : : uint32_t type:8;
1789 : : uint32_t max_resp_time:8;
1790 : : uint32_t checksum:16;
1791 : : uint32_t group_addr;
1792 : : };
1793 : :
1794 : : /** Default mask for RTE_FLOW_ITEM_TYPE_IGMP. */
1795 : : #ifndef __cplusplus
1796 : : static const struct rte_flow_item_igmp rte_flow_item_igmp_mask = {
1797 : : .group_addr = 0xffffffff,
1798 : : };
1799 : : #endif
1800 : :
1801 : : /**
1802 : : * @warning
1803 : : * @b EXPERIMENTAL: this structure may change without prior notice
1804 : : *
1805 : : * RTE_FLOW_ITEM_TYPE_AH
1806 : : *
1807 : : * Match IP Authentication Header (AH), RFC 4302
1808 : : */
1809 : : struct rte_flow_item_ah {
1810 : : uint32_t next_hdr:8;
1811 : : uint32_t payload_len:8;
1812 : : uint32_t reserved:16;
1813 : : uint32_t spi;
1814 : : uint32_t seq_num;
1815 : : };
1816 : :
1817 : : /** Default mask for RTE_FLOW_ITEM_TYPE_AH. */
1818 : : #ifndef __cplusplus
1819 : : static const struct rte_flow_item_ah rte_flow_item_ah_mask = {
1820 : : .spi = 0xffffffff,
1821 : : };
1822 : : #endif
1823 : :
1824 : : /**
1825 : : * @warning
1826 : : * @b EXPERIMENTAL: this structure may change without prior notice
1827 : : *
1828 : : * RTE_FLOW_ITEM_TYPE_PFCP
1829 : : *
1830 : : * Match PFCP Header
1831 : : */
1832 : : struct rte_flow_item_pfcp {
1833 : : uint8_t s_field;
1834 : : uint8_t msg_type;
1835 : : rte_be16_t msg_len;
1836 : : rte_be64_t seid;
1837 : : };
1838 : :
1839 : : /** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
1840 : : #ifndef __cplusplus
1841 : : static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
1842 : : .s_field = 0x01,
1843 : : .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
1844 : : };
1845 : : #endif
1846 : :
1847 : : /**
1848 : : * @warning
1849 : : * @b EXPERIMENTAL: this structure may change without prior notice
1850 : : *
1851 : : * RTE_FLOW_ITEM_TYPE_ECPRI
1852 : : *
1853 : : * Match eCPRI Header
1854 : : */
1855 : : struct rte_flow_item_ecpri {
1856 : : struct rte_ecpri_combined_msg_hdr hdr;
1857 : : };
1858 : :
1859 : : /** Default mask for RTE_FLOW_ITEM_TYPE_ECPRI. */
1860 : : #ifndef __cplusplus
1861 : : static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask = {
1862 : : .hdr = {
1863 : : .common = {
1864 : : .u32 = 0x0,
1865 : : },
1866 : : },
1867 : : };
1868 : : #endif
1869 : :
1870 : : /**
1871 : : * RTE_FLOW_ITEM_TYPE_GENEVE_OPT
1872 : : *
1873 : : * Matches a GENEVE Variable Length Option
1874 : : */
1875 : : struct rte_flow_item_geneve_opt {
1876 : : rte_be16_t option_class;
1877 : : uint8_t option_type;
1878 : : uint8_t option_len;
1879 : : uint32_t *data;
1880 : : };
1881 : :
1882 : : /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE_OPT. */
1883 : : #ifndef __cplusplus
1884 : : static const struct rte_flow_item_geneve_opt
1885 : : rte_flow_item_geneve_opt_mask = {
1886 : : .option_type = 0xff,
1887 : : };
1888 : : #endif
1889 : :
1890 : : /**
1891 : : * @warning
1892 : : * @b EXPERIMENTAL: this structure may change without prior notice
1893 : : *
1894 : : * RTE_FLOW_ITEM_TYPE_INTEGRITY
1895 : : *
1896 : : * Match on packet integrity check result.
1897 : : */
1898 : : struct rte_flow_item_integrity {
1899 : : /** Tunnel encapsulation level the item should apply to.
1900 : : * @see rte_flow_action_rss
1901 : : */
1902 : : uint32_t level;
1903 : : union {
1904 : : __extension__
1905 : : struct {
1906 : : /** The packet is valid after passing all HW checks. */
1907 : : uint64_t packet_ok:1;
1908 : : /** L2 layer is valid after passing all HW checks. */
1909 : : uint64_t l2_ok:1;
1910 : : /** L3 layer is valid after passing all HW checks. */
1911 : : uint64_t l3_ok:1;
1912 : : /** L4 layer is valid after passing all HW checks. */
1913 : : uint64_t l4_ok:1;
1914 : : /** L2 layer CRC is valid. */
1915 : : uint64_t l2_crc_ok:1;
1916 : : /** IPv4 layer checksum is valid. */
1917 : : uint64_t ipv4_csum_ok:1;
1918 : : /** L4 layer checksum is valid. */
1919 : : uint64_t l4_csum_ok:1;
1920 : : /** L3 length is smaller than frame length. */
1921 : : uint64_t l3_len_ok:1;
1922 : : uint64_t reserved:56;
1923 : : };
1924 : : uint64_t value;
1925 : : };
1926 : : };
1927 : :
1928 : : #ifndef __cplusplus
1929 : : static const struct rte_flow_item_integrity
1930 : : rte_flow_item_integrity_mask = {
1931 : : .level = 0,
1932 : : .value = 0,
1933 : : };
1934 : : #endif
1935 : :
1936 : : /**
1937 : : * The packet is valid after conntrack checking.
1938 : : */
1939 : : #define RTE_FLOW_CONNTRACK_PKT_STATE_VALID RTE_BIT32(0)
1940 : : /**
1941 : : * The state of the connection is changed.
1942 : : */
1943 : : #define RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED RTE_BIT32(1)
1944 : : /**
1945 : : * Error is detected on this packet for this connection and
1946 : : * an invalid state is set.
1947 : : */
1948 : : #define RTE_FLOW_CONNTRACK_PKT_STATE_INVALID RTE_BIT32(2)
1949 : : /**
1950 : : * The HW connection tracking module is disabled.
1951 : : * It can be due to application command or an invalid state.
1952 : : */
1953 : : #define RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED RTE_BIT32(3)
1954 : : /**
1955 : : * The packet contains some bad field(s) and cannot continue
1956 : : * with the conntrack module checking.
1957 : : */
1958 : : #define RTE_FLOW_CONNTRACK_PKT_STATE_BAD RTE_BIT32(4)
1959 : :
1960 : : /**
1961 : : * @warning
1962 : : * @b EXPERIMENTAL: this structure may change without prior notice
1963 : : *
1964 : : * RTE_FLOW_ITEM_TYPE_CONNTRACK
1965 : : *
1966 : : * Matches the state of a packet after it passed the connection tracking
1967 : : * examination. The state is a bitmap of one RTE_FLOW_CONNTRACK_PKT_STATE*
1968 : : * or a reasonable combination of these bits.
1969 : : */
1970 : : struct rte_flow_item_conntrack {
1971 : : uint32_t flags;
1972 : : };
1973 : :
1974 : : /** Default mask for RTE_FLOW_ITEM_TYPE_CONNTRACK. */
1975 : : #ifndef __cplusplus
1976 : : static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = {
1977 : : .flags = 0xffffffff,
1978 : : };
1979 : : #endif
1980 : :
1981 : : /**
1982 : : * Provides an ethdev port ID for use with the following items:
1983 : : * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
1984 : : * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT.
1985 : : */
1986 : : struct rte_flow_item_ethdev {
1987 : : uint16_t port_id; /**< ethdev port ID */
1988 : : };
1989 : :
1990 : : /** Default mask for items based on struct rte_flow_item_ethdev */
1991 : : #ifndef __cplusplus
1992 : : static const struct rte_flow_item_ethdev rte_flow_item_ethdev_mask = {
1993 : : .port_id = 0xffff,
1994 : : };
1995 : : #endif
1996 : :
1997 : : /**
1998 : : * @warning
1999 : : * @b EXPERIMENTAL: this structure may change without prior notice
2000 : : *
2001 : : * RTE_FLOW_ITEM_TYPE_L2TPV2
2002 : : *
2003 : : * Matches L2TPv2 Header
2004 : : */
2005 : : struct rte_flow_item_l2tpv2 {
2006 : : struct rte_l2tpv2_combined_msg_hdr hdr;
2007 : : };
2008 : :
2009 : : /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV2. */
2010 : : #ifndef __cplusplus
2011 : : static const struct rte_flow_item_l2tpv2 rte_flow_item_l2tpv2_mask = {
2012 : : /*
2013 : : * flags and version bit mask
2014 : : * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
2015 : : * T L x x S x O P x x x x V V V V
2016 : : */
2017 : : .hdr = {
2018 : : .common = {
2019 : : .flags_version = RTE_BE16(0xcb0f),
2020 : : },
2021 : : },
2022 : : };
2023 : : #endif
2024 : :
2025 : : /**
2026 : : * @warning
2027 : : * @b EXPERIMENTAL: this structure may change without prior notice
2028 : : *
2029 : : * RTE_FLOW_ITEM_TYPE_PPP
2030 : : *
2031 : : * Matches PPP Header
2032 : : */
2033 : : struct rte_flow_item_ppp {
2034 : : struct rte_ppp_hdr hdr;
2035 : : };
2036 : :
2037 : : /** Default mask for RTE_FLOW_ITEM_TYPE_PPP. */
2038 : : #ifndef __cplusplus
2039 : : static const struct rte_flow_item_ppp rte_flow_item_ppp_mask = {
2040 : : .hdr = {
2041 : : .addr = 0xff,
2042 : : .ctrl = 0xff,
2043 : : .proto_id = RTE_BE16(0xffff),
2044 : : }
2045 : : };
2046 : : #endif
2047 : :
2048 : : /**
2049 : : * RTE_FLOW_ITEM_TYPE_IB_BTH.
2050 : : *
2051 : : * Matches an InfiniBand base transport header in RoCE packet.
2052 : : */
2053 : : struct rte_flow_item_ib_bth {
2054 : : struct rte_ib_bth hdr; /**< InfiniBand base transport header definition. */
2055 : : };
2056 : :
2057 : : /** Default mask for RTE_FLOW_ITEM_TYPE_IB_BTH. */
2058 : : #ifndef __cplusplus
2059 : : static const struct rte_flow_item_ib_bth rte_flow_item_ib_bth_mask = {
2060 : : .hdr = {
2061 : : .opcode = 0xff,
2062 : : .dst_qp = "\xff\xff\xff",
2063 : : },
2064 : : };
2065 : : #endif
2066 : :
2067 : : /**
2068 : : * @warning
2069 : : * @b EXPERIMENTAL: this structure may change without prior notice.
2070 : : *
2071 : : * RTE_FLOW_ITEM_TYPE_RANDOM
2072 : : *
2073 : : * Matches a random value.
2074 : : */
2075 : : struct rte_flow_item_random {
2076 : : uint32_t value;
2077 : : };
2078 : :
2079 : : /** Default mask for RTE_FLOW_ITEM_TYPE_RANDOM. */
2080 : : #ifndef __cplusplus
2081 : : static const struct rte_flow_item_random rte_flow_item_random_mask = {
2082 : : .value = UINT32_MAX,
2083 : : };
2084 : : #endif
2085 : :
2086 : : /**
2087 : : * Matching pattern item definition.
2088 : : *
2089 : : * A pattern is formed by stacking items starting from the lowest protocol
2090 : : * layer to match. This stacking restriction does not apply to meta items
2091 : : * which can be placed anywhere in the stack without affecting the meaning
2092 : : * of the resulting pattern.
2093 : : *
2094 : : * Patterns are terminated by END items.
2095 : : *
2096 : : * The spec field should be a valid pointer to a structure of the related
2097 : : * item type. It may remain unspecified (NULL) in many cases to request
2098 : : * broad (nonspecific) matching. In such cases, last and mask must also be
2099 : : * set to NULL.
2100 : : *
2101 : : * Optionally, last can point to a structure of the same type to define an
2102 : : * inclusive range. This is mostly supported by integer and address fields,
2103 : : * may cause errors otherwise. Fields that do not support ranges must be set
2104 : : * to 0 or to the same value as the corresponding fields in spec.
2105 : : *
2106 : : * Only the fields defined to nonzero values in the default masks (see
2107 : : * rte_flow_item_{name}_mask constants) are considered relevant by
2108 : : * default. This can be overridden by providing a mask structure of the
2109 : : * same type with applicable bits set to one. It can also be used to
2110 : : * partially filter out specific fields (e.g. as an alternate mean to match
2111 : : * ranges of IP addresses).
2112 : : *
2113 : : * Mask is a simple bit-mask applied before interpreting the contents of
2114 : : * spec and last, which may yield unexpected results if not used
2115 : : * carefully. For example, if for an IPv4 address field, spec provides
2116 : : * 10.1.2.3, last provides 10.3.4.5 and mask provides 255.255.0.0, the
2117 : : * effective range becomes 10.1.0.0 to 10.3.255.255.
2118 : : */
2119 : : struct rte_flow_item {
2120 : : enum rte_flow_item_type type; /**< Item type. */
2121 : : const void *spec; /**< Pointer to item specification structure. */
2122 : : const void *last; /**< Defines an inclusive range (spec to last). */
2123 : : const void *mask; /**< Bit-mask applied to spec and last. */
2124 : : };
2125 : :
2126 : : /**
2127 : : * @warning
2128 : : * @b EXPERIMENTAL: this structure may change without prior notice
2129 : : *
2130 : : * RTE_FLOW_ITEM_TYPE_FLEX
2131 : : *
2132 : : * Matches a specified set of fields within the network protocol
2133 : : * header. Each field is presented as set of bits with specified width, and
2134 : : * bit offset from the header beginning.
2135 : : *
2136 : : * The pattern is concatenation of bit fields configured at item creation
2137 : : * by rte_flow_flex_item_create(). At configuration the fields are presented
2138 : : * by sample_data array.
2139 : : *
2140 : : * This type does not support ranges (struct rte_flow_item.last).
2141 : : */
2142 : : struct rte_flow_item_flex {
2143 : : struct rte_flow_item_flex_handle *handle; /**< Opaque item handle. */
2144 : : uint32_t length; /**< Pattern length in bytes. */
2145 : : const uint8_t *pattern; /**< Combined bitfields pattern to match. */
2146 : : };
2147 : : /**
2148 : : * Field bit offset calculation mode.
2149 : : */
2150 : : enum rte_flow_item_flex_field_mode {
2151 : : /**
2152 : : * Dummy field, used for byte boundary alignment in pattern.
2153 : : * Pattern mask and data are ignored in the match. All configuration
2154 : : * parameters besides field size are ignored.
2155 : : */
2156 : : FIELD_MODE_DUMMY = 0,
2157 : : /**
2158 : : * Fixed offset field. The bit offset from header beginning
2159 : : * is permanent and defined by field_base parameter.
2160 : : */
2161 : : FIELD_MODE_FIXED,
2162 : : /**
2163 : : * The field bit offset is extracted from other header field (indirect
2164 : : * offset field). The resulting field offset to match is calculated as:
2165 : : *
2166 : : * field_base + (*offset_base & offset_mask) << offset_shift
2167 : : */
2168 : : FIELD_MODE_OFFSET,
2169 : : /**
2170 : : * The field bit offset is extracted from other header field (indirect
2171 : : * offset field), the latter is considered as bitmask containing some
2172 : : * number of one bits, the resulting field offset to match is
2173 : : * calculated as:
2174 : : *
2175 : : * field_base + bitcount(*offset_base & offset_mask) << offset_shift
2176 : : */
2177 : : FIELD_MODE_BITMASK,
2178 : : };
2179 : :
2180 : : /**
2181 : : * Flex item field tunnel mode
2182 : : */
2183 : : enum rte_flow_item_flex_tunnel_mode {
2184 : : /**
2185 : : * The protocol header can be present in the packet only once.
2186 : : * No multiple flex item flow inclusions (for inner/outer) are allowed.
2187 : : * No any relations with tunnel protocols are imposed. The drivers
2188 : : * can optimize hardware resource usage to handle match on single flex
2189 : : * item of specific type.
2190 : : */
2191 : : FLEX_TUNNEL_MODE_SINGLE = 0,
2192 : : /**
2193 : : * Flex item presents outer header only.
2194 : : */
2195 : : FLEX_TUNNEL_MODE_OUTER,
2196 : : /**
2197 : : * Flex item presents inner header only.
2198 : : */
2199 : : FLEX_TUNNEL_MODE_INNER,
2200 : : /**
2201 : : * Flex item presents either inner or outer header. The driver
2202 : : * handles as many multiple inners as hardware supports.
2203 : : */
2204 : : FLEX_TUNNEL_MODE_MULTI,
2205 : : /**
2206 : : * Flex item presents tunnel protocol header.
2207 : : */
2208 : : FLEX_TUNNEL_MODE_TUNNEL,
2209 : : };
2210 : :
2211 : : /**
2212 : : *
2213 : : * @warning
2214 : : * @b EXPERIMENTAL: this structure may change without prior notice
2215 : : */
2216 : : __extension__
2217 : : struct rte_flow_item_flex_field {
2218 : : /** Defines how match field offset is calculated over the packet. */
2219 : : enum rte_flow_item_flex_field_mode field_mode;
2220 : : uint32_t field_size; /**< Field size in bits. */
2221 : : int32_t field_base; /**< Field offset in bits. */
2222 : : uint32_t offset_base; /**< Indirect offset field offset in bits. */
2223 : : uint32_t offset_mask; /**< Indirect offset field bit mask. */
2224 : : int32_t offset_shift; /**< Indirect offset multiply factor. */
2225 : : uint32_t field_id:16; /**< Device hint, for multiple items in flow. */
2226 : : uint32_t reserved:16; /**< Reserved field. */
2227 : : };
2228 : :
2229 : : /**
2230 : : * @warning
2231 : : * @b EXPERIMENTAL: this structure may change without prior notice
2232 : : */
2233 : : struct rte_flow_item_flex_link {
2234 : : /**
2235 : : * Preceding/following header. The item type must be always provided.
2236 : : * For preceding one item must specify the header value/mask to match
2237 : : * for the link be taken and start the flex item header parsing.
2238 : : */
2239 : : struct rte_flow_item item;
2240 : : /**
2241 : : * Next field value to match to continue with one of the configured
2242 : : * next protocols.
2243 : : */
2244 : : uint32_t next;
2245 : : };
2246 : :
2247 : : /**
2248 : : * @warning
2249 : : * @b EXPERIMENTAL: this structure may change without prior notice
2250 : : */
2251 : : struct rte_flow_item_flex_conf {
2252 : : /**
2253 : : * Specifies the flex item and tunnel relations and tells the PMD
2254 : : * whether flex item can be used for inner, outer or both headers,
2255 : : * or whether flex item presents the tunnel protocol itself.
2256 : : */
2257 : : enum rte_flow_item_flex_tunnel_mode tunnel;
2258 : : /**
2259 : : * The next header offset, it presents the network header size covered
2260 : : * by the flex item and can be obtained with all supported offset
2261 : : * calculating methods (fixed, dedicated field, bitmask, etc).
2262 : : */
2263 : : struct rte_flow_item_flex_field next_header;
2264 : : /**
2265 : : * Specifies the next protocol field to match with link next protocol
2266 : : * values and continue packet parsing with matching link.
2267 : : */
2268 : : struct rte_flow_item_flex_field next_protocol;
2269 : : /**
2270 : : * The fields will be sampled and presented for explicit match
2271 : : * with pattern in the rte_flow_flex_item. There can be multiple
2272 : : * fields descriptors, the number should be specified by nb_samples.
2273 : : */
2274 : : struct rte_flow_item_flex_field *sample_data;
2275 : : /** Number of field descriptors in the sample_data array. */
2276 : : uint32_t nb_samples;
2277 : : /**
2278 : : * Input link defines the flex item relation with preceding
2279 : : * header. It specified the preceding item type and provides pattern
2280 : : * to match. The flex item will continue parsing and will provide the
2281 : : * data to flow match in case if there is the match with one of input
2282 : : * links.
2283 : : */
2284 : : struct rte_flow_item_flex_link *input_link;
2285 : : /** Number of link descriptors in the input link array. */
2286 : : uint32_t nb_inputs;
2287 : : /**
2288 : : * Output link defines the next protocol field value to match and
2289 : : * the following protocol header to continue packet parsing. Also
2290 : : * defines the tunnel-related behaviour.
2291 : : */
2292 : : struct rte_flow_item_flex_link *output_link;
2293 : : /** Number of link descriptors in the output link array. */
2294 : : uint32_t nb_outputs;
2295 : : };
2296 : :
2297 : : /**
2298 : : * RTE_FLOW_ITEM_TYPE_METER_COLOR.
2299 : : *
2300 : : * Matches Color Marker set by a Meter.
2301 : : */
2302 : : struct rte_flow_item_meter_color {
2303 : : enum rte_color color; /**< Meter color marker. */
2304 : : };
2305 : :
2306 : : /** Default mask for RTE_FLOW_ITEM_TYPE_METER_COLOR. */
2307 : : #ifndef __cplusplus
2308 : : static const struct rte_flow_item_meter_color rte_flow_item_meter_color_mask = {
2309 : : .color = RTE_COLORS,
2310 : : };
2311 : : #endif
2312 : :
2313 : : /**
2314 : : * @warning
2315 : : * @b EXPERIMENTAL: this structure may change without prior notice
2316 : : *
2317 : : * RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY
2318 : : *
2319 : : * For multiple ports aggregated to a single DPDK port,
2320 : : * match the aggregated port receiving the packets.
2321 : : */
2322 : : struct rte_flow_item_aggr_affinity {
2323 : : /**
2324 : : * An aggregated port receiving the packets.
2325 : : * Numbering starts from 1.
2326 : : * Number of aggregated ports is reported by rte_eth_dev_count_aggr_ports().
2327 : : */
2328 : : uint8_t affinity;
2329 : : };
2330 : :
2331 : : /** Default mask for RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY. */
2332 : : #ifndef __cplusplus
2333 : : static const struct rte_flow_item_aggr_affinity
2334 : : rte_flow_item_aggr_affinity_mask = {
2335 : : .affinity = 0xff,
2336 : : };
2337 : : #endif
2338 : :
2339 : : /**
2340 : : * RTE_FLOW_ITEM_TYPE_TX_QUEUE
2341 : : *
2342 : : * Tx queue number.
2343 : : *
2344 : : * @see struct rte_flow_item_tx_queue
2345 : : */
2346 : : struct rte_flow_item_tx_queue {
2347 : : /** Tx queue number of packet being transmitted. */
2348 : : uint16_t tx_queue;
2349 : : };
2350 : :
2351 : : /** Default mask for RTE_FLOW_ITEM_TX_QUEUE. */
2352 : : #ifndef __cplusplus
2353 : : static const struct rte_flow_item_tx_queue rte_flow_item_tx_queue_mask = {
2354 : : .tx_queue = 0xffff,
2355 : : };
2356 : : #endif
2357 : :
2358 : : /**
2359 : : *
2360 : : * RTE_FLOW_ITEM_TYPE_PTYPE
2361 : : *
2362 : : * Matches the packet type as defined in rte_mbuf_ptype.
2363 : : */
2364 : : struct rte_flow_item_ptype {
2365 : : uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
2366 : : };
2367 : :
2368 : : /** Default mask for RTE_FLOW_ITEM_TYPE_PTYPE. */
2369 : : #ifndef __cplusplus
2370 : : static const struct rte_flow_item_ptype rte_flow_item_ptype_mask = {
2371 : : .packet_type = 0xffffffff,
2372 : : };
2373 : : #endif
2374 : :
2375 : : /**
2376 : : * Packet header field IDs, used by RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2377 : : * and RTE_FLOW_ITEM_TYPE_COMPARE.
2378 : : */
2379 : : enum rte_flow_field_id {
2380 : : RTE_FLOW_FIELD_START = 0, /**< Start of a packet. */
2381 : : RTE_FLOW_FIELD_MAC_DST, /**< Destination MAC Address. */
2382 : : RTE_FLOW_FIELD_MAC_SRC, /**< Source MAC Address. */
2383 : : RTE_FLOW_FIELD_VLAN_TYPE, /**< VLAN Tag Identifier. */
2384 : : RTE_FLOW_FIELD_VLAN_ID, /**< VLAN Identifier. */
2385 : : RTE_FLOW_FIELD_MAC_TYPE, /**< EtherType. */
2386 : : RTE_FLOW_FIELD_IPV4_DSCP, /**< IPv4 DSCP. */
2387 : : RTE_FLOW_FIELD_IPV4_TTL, /**< IPv4 Time To Live. */
2388 : : RTE_FLOW_FIELD_IPV4_SRC, /**< IPv4 Source Address. */
2389 : : RTE_FLOW_FIELD_IPV4_DST, /**< IPv4 Destination Address. */
2390 : : RTE_FLOW_FIELD_IPV6_DSCP, /**< IPv6 DSCP. */
2391 : : RTE_FLOW_FIELD_IPV6_HOPLIMIT, /**< IPv6 Hop Limit. */
2392 : : RTE_FLOW_FIELD_IPV6_SRC, /**< IPv6 Source Address. */
2393 : : RTE_FLOW_FIELD_IPV6_DST, /**< IPv6 Destination Address. */
2394 : : RTE_FLOW_FIELD_TCP_PORT_SRC, /**< TCP Source Port Number. */
2395 : : RTE_FLOW_FIELD_TCP_PORT_DST, /**< TCP Destination Port Number. */
2396 : : RTE_FLOW_FIELD_TCP_SEQ_NUM, /**< TCP Sequence Number. */
2397 : : RTE_FLOW_FIELD_TCP_ACK_NUM, /**< TCP Acknowledgment Number. */
2398 : : RTE_FLOW_FIELD_TCP_FLAGS, /**< TCP Flags. */
2399 : : RTE_FLOW_FIELD_UDP_PORT_SRC, /**< UDP Source Port Number. */
2400 : : RTE_FLOW_FIELD_UDP_PORT_DST, /**< UDP Destination Port Number. */
2401 : : RTE_FLOW_FIELD_VXLAN_VNI, /**< VXLAN Network Identifier. */
2402 : : RTE_FLOW_FIELD_GENEVE_VNI, /**< GENEVE Network Identifier. */
2403 : : RTE_FLOW_FIELD_GTP_TEID, /**< GTP Tunnel Endpoint Identifier. */
2404 : : RTE_FLOW_FIELD_TAG, /**< Tag value. */
2405 : : RTE_FLOW_FIELD_MARK, /**< Mark value. */
2406 : : RTE_FLOW_FIELD_META, /**< Metadata value. */
2407 : : RTE_FLOW_FIELD_POINTER, /**< Memory pointer. */
2408 : : RTE_FLOW_FIELD_VALUE, /**< Immediate value. */
2409 : : RTE_FLOW_FIELD_IPV4_ECN, /**< IPv4 ECN. */
2410 : : RTE_FLOW_FIELD_IPV6_ECN, /**< IPv6 ECN. */
2411 : : RTE_FLOW_FIELD_GTP_PSC_QFI, /**< GTP QFI. */
2412 : : RTE_FLOW_FIELD_METER_COLOR, /**< Meter color marker. */
2413 : : RTE_FLOW_FIELD_IPV6_PROTO, /**< IPv6 next header. */
2414 : : RTE_FLOW_FIELD_FLEX_ITEM, /**< Flex item. */
2415 : : RTE_FLOW_FIELD_HASH_RESULT, /**< Hash result. */
2416 : : RTE_FLOW_FIELD_GENEVE_OPT_TYPE, /**< GENEVE option type. */
2417 : : RTE_FLOW_FIELD_GENEVE_OPT_CLASS,/**< GENEVE option class. */
2418 : : RTE_FLOW_FIELD_GENEVE_OPT_DATA, /**< GENEVE option data. */
2419 : : RTE_FLOW_FIELD_MPLS, /**< MPLS header. */
2420 : : RTE_FLOW_FIELD_TCP_DATA_OFFSET, /**< TCP data offset. */
2421 : : RTE_FLOW_FIELD_IPV4_IHL, /**< IPv4 IHL. */
2422 : : RTE_FLOW_FIELD_IPV4_TOTAL_LEN, /**< IPv4 total length. */
2423 : : RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN,/**< IPv6 payload length. */
2424 : : RTE_FLOW_FIELD_IPV4_PROTO, /**< IPv4 next protocol. */
2425 : : RTE_FLOW_FIELD_IPV6_FLOW_LABEL, /**< IPv6 flow label. */
2426 : : RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS, /**< IPv6 traffic class. */
2427 : : RTE_FLOW_FIELD_ESP_SPI, /**< ESP SPI. */
2428 : : RTE_FLOW_FIELD_ESP_SEQ_NUM, /**< ESP Sequence Number. */
2429 : : RTE_FLOW_FIELD_ESP_PROTO, /**< ESP next protocol value. */
2430 : : RTE_FLOW_FIELD_RANDOM, /**< Random value. */
2431 : : };
2432 : :
2433 : : /**
2434 : : * @warning
2435 : : * @b EXPERIMENTAL: this structure may change without prior notice.
2436 : : *
2437 : : * Packet header field descriptions, used by RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2438 : : * and RTE_FLOW_ITEM_TYPE_COMPARE.
2439 : : */
2440 : : struct rte_flow_field_data {
2441 : : enum rte_flow_field_id field; /**< Field or memory type ID. */
2442 : : union {
2443 : : struct {
2444 : : /** Encapsulation level and tag index or flex item handle. */
2445 : : union {
2446 : : struct {
2447 : : /**
2448 : : * Packet encapsulation level containing
2449 : : * the field to modify.
2450 : : *
2451 : : * - @p 0 requests the default behavior.
2452 : : * Depending on the packet type, it
2453 : : * can mean outermost, innermost or
2454 : : * anything in between.
2455 : : *
2456 : : * It basically stands for the
2457 : : * innermost encapsulation level.
2458 : : * Modification can be performed
2459 : : * according to PMD and device
2460 : : * capabilities.
2461 : : *
2462 : : * - @p 1 requests modification to be
2463 : : * performed on the outermost packet
2464 : : * encapsulation level.
2465 : : *
2466 : : * - @p 2 and subsequent values request
2467 : : * modification to be performed on
2468 : : * the specified inner packet
2469 : : * encapsulation level, from
2470 : : * outermost to innermost (lower to
2471 : : * higher values).
2472 : : *
2473 : : * Values other than @p 0 are not
2474 : : * necessarily supported.
2475 : : *
2476 : : * @note that for MPLS field,
2477 : : * encapsulation level also include
2478 : : * tunnel since MPLS may appear in
2479 : : * outer, inner or tunnel.
2480 : : */
2481 : : uint8_t level;
2482 : : union {
2483 : : /**
2484 : : * Tag index array inside
2485 : : * encapsulation level.
2486 : : * Used for VLAN, MPLS or TAG types.
2487 : : */
2488 : : uint8_t tag_index;
2489 : : /**
2490 : : * Geneve option identifier.
2491 : : * Relevant only for
2492 : : * RTE_FLOW_FIELD_GENEVE_OPT_XXXX
2493 : : * modification type.
2494 : : */
2495 : : struct {
2496 : : /**
2497 : : * Geneve option type.
2498 : : */
2499 : : uint8_t type;
2500 : : /**
2501 : : * Geneve option class.
2502 : : */
2503 : : rte_be16_t class_id;
2504 : : };
2505 : : };
2506 : : };
2507 : : struct rte_flow_item_flex_handle *flex_handle;
2508 : : };
2509 : : /** Number of bits to skip from a field. */
2510 : : uint32_t offset;
2511 : : };
2512 : : /**
2513 : : * Immediate value for RTE_FLOW_FIELD_VALUE, presented in the
2514 : : * same byte order and length as in relevant rte_flow_item_xxx.
2515 : : * The immediate source bitfield offset is inherited from
2516 : : * the destination's one.
2517 : : */
2518 : : uint8_t value[16];
2519 : : /**
2520 : : * Memory address for RTE_FLOW_FIELD_POINTER, memory layout
2521 : : * should be the same as for relevant field in the
2522 : : * rte_flow_item_xxx structure.
2523 : : */
2524 : : void *pvalue;
2525 : : };
2526 : : };
2527 : :
2528 : : /**
2529 : : * Expected operation types for compare item.
2530 : : */
2531 : : enum rte_flow_item_compare_op {
2532 : : RTE_FLOW_ITEM_COMPARE_EQ, /* Compare result equal. */
2533 : : RTE_FLOW_ITEM_COMPARE_NE, /* Compare result not equal. */
2534 : : RTE_FLOW_ITEM_COMPARE_LT, /* Compare result less than. */
2535 : : RTE_FLOW_ITEM_COMPARE_LE, /* Compare result less than or equal. */
2536 : : RTE_FLOW_ITEM_COMPARE_GT, /* Compare result great than. */
2537 : : RTE_FLOW_ITEM_COMPARE_GE, /* Compare result great than or equal. */
2538 : : };
2539 : :
2540 : : /**
2541 : : *
2542 : : * RTE_FLOW_ITEM_TYPE_COMPARE
2543 : : *
2544 : : * Matches the packet with compare result.
2545 : : *
2546 : : * The operation means a compare with b result.
2547 : : */
2548 : : struct rte_flow_item_compare {
2549 : : enum rte_flow_item_compare_op operation; /* The compare operation. */
2550 : : struct rte_flow_field_data a; /* Field be compared. */
2551 : : struct rte_flow_field_data b; /* Field as comparator. */
2552 : : uint32_t width; /* Compare width. */
2553 : : };
2554 : :
2555 : : /**
2556 : : * Action types.
2557 : : *
2558 : : * Each possible action is represented by a type.
2559 : : * An action can have an associated configuration object.
2560 : : * Several actions combined in a list can be assigned
2561 : : * to a flow rule and are performed in order.
2562 : : *
2563 : : * They fall in three categories:
2564 : : *
2565 : : * - Actions that modify the fate of matching traffic, for instance by
2566 : : * dropping or assigning it a specific destination.
2567 : : *
2568 : : * - Actions that modify matching traffic contents or its properties. This
2569 : : * includes adding/removing encapsulation, encryption, compression and
2570 : : * marks.
2571 : : *
2572 : : * - Actions related to the flow rule itself, such as updating counters or
2573 : : * making it non-terminating.
2574 : : *
2575 : : * Flow rules being terminating by default, not specifying any action of the
2576 : : * fate kind results in undefined behavior. This applies to both ingress and
2577 : : * egress.
2578 : : *
2579 : : * PASSTHRU, when supported, makes a flow rule non-terminating.
2580 : : */
2581 : : enum rte_flow_action_type {
2582 : : /**
2583 : : * End marker for action lists. Prevents further processing of
2584 : : * actions, thereby ending the list.
2585 : : *
2586 : : * No associated configuration structure.
2587 : : */
2588 : : RTE_FLOW_ACTION_TYPE_END,
2589 : :
2590 : : /**
2591 : : * Used as a placeholder for convenience. It is ignored and simply
2592 : : * discarded by PMDs.
2593 : : *
2594 : : * No associated configuration structure.
2595 : : */
2596 : : RTE_FLOW_ACTION_TYPE_VOID,
2597 : :
2598 : : /**
2599 : : * Leaves traffic up for additional processing by subsequent flow
2600 : : * rules; makes a flow rule non-terminating.
2601 : : *
2602 : : * No associated configuration structure.
2603 : : */
2604 : : RTE_FLOW_ACTION_TYPE_PASSTHRU,
2605 : :
2606 : : /**
2607 : : * RTE_FLOW_ACTION_TYPE_JUMP
2608 : : *
2609 : : * Redirects packets to a group on the current device.
2610 : : *
2611 : : * See struct rte_flow_action_jump.
2612 : : */
2613 : : RTE_FLOW_ACTION_TYPE_JUMP,
2614 : :
2615 : : /**
2616 : : * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
2617 : : * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
2618 : : *
2619 : : * See struct rte_flow_action_mark.
2620 : : *
2621 : : * One should negotiate mark delivery from the NIC to the PMD.
2622 : : * @see rte_eth_rx_metadata_negotiate()
2623 : : * @see RTE_ETH_RX_METADATA_USER_MARK
2624 : : */
2625 : : RTE_FLOW_ACTION_TYPE_MARK,
2626 : :
2627 : : /**
2628 : : * Flags packets. Similar to MARK without a specific value; only
2629 : : * sets the RTE_MBUF_F_RX_FDIR mbuf flag.
2630 : : *
2631 : : * No associated configuration structure.
2632 : : *
2633 : : * One should negotiate flag delivery from the NIC to the PMD.
2634 : : * @see rte_eth_rx_metadata_negotiate()
2635 : : * @see RTE_ETH_RX_METADATA_USER_FLAG
2636 : : */
2637 : : RTE_FLOW_ACTION_TYPE_FLAG,
2638 : :
2639 : : /**
2640 : : * Assigns packets to a given queue index.
2641 : : *
2642 : : * See struct rte_flow_action_queue.
2643 : : */
2644 : : RTE_FLOW_ACTION_TYPE_QUEUE,
2645 : :
2646 : : /**
2647 : : * Drops packets.
2648 : : *
2649 : : * PASSTHRU overrides this action if both are specified.
2650 : : *
2651 : : * No associated configuration structure.
2652 : : */
2653 : : RTE_FLOW_ACTION_TYPE_DROP,
2654 : :
2655 : : /**
2656 : : * Enables counters for this flow rule.
2657 : : *
2658 : : * These counters can be retrieved and reset through rte_flow_query() or
2659 : : * rte_flow_action_handle_query() if the action provided via handle,
2660 : : * see struct rte_flow_query_count.
2661 : : *
2662 : : * See struct rte_flow_action_count.
2663 : : */
2664 : : RTE_FLOW_ACTION_TYPE_COUNT,
2665 : :
2666 : : /**
2667 : : * Similar to QUEUE, except RSS is additionally performed on packets
2668 : : * to spread them among several queues according to the provided
2669 : : * parameters.
2670 : : *
2671 : : * See struct rte_flow_action_rss.
2672 : : */
2673 : : RTE_FLOW_ACTION_TYPE_RSS,
2674 : :
2675 : : /**
2676 : : * @deprecated
2677 : : * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2678 : : * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2679 : : *
2680 : : * Directs matching traffic to the physical function (PF) of the
2681 : : * current device.
2682 : : *
2683 : : * No associated configuration structure.
2684 : : */
2685 : : RTE_FLOW_ACTION_TYPE_PF,
2686 : :
2687 : : /**
2688 : : * @deprecated
2689 : : * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2690 : : * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2691 : : *
2692 : : * Directs matching traffic to a given virtual function of the
2693 : : * current device.
2694 : : *
2695 : : * See struct rte_flow_action_vf.
2696 : : */
2697 : : RTE_FLOW_ACTION_TYPE_VF,
2698 : :
2699 : : /**
2700 : : * @deprecated
2701 : : * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
2702 : : * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
2703 : : *
2704 : : * Directs matching traffic to a given DPDK port ID.
2705 : : *
2706 : : * See struct rte_flow_action_port_id.
2707 : : */
2708 : : RTE_FLOW_ACTION_TYPE_PORT_ID,
2709 : :
2710 : : /**
2711 : : * Traffic metering and policing (MTR).
2712 : : *
2713 : : * See struct rte_flow_action_meter.
2714 : : * See file rte_mtr.h for MTR object configuration.
2715 : : */
2716 : : RTE_FLOW_ACTION_TYPE_METER,
2717 : :
2718 : : /**
2719 : : * Redirects packets to security engine of current device for security
2720 : : * processing as specified by security session.
2721 : : *
2722 : : * See struct rte_flow_action_security.
2723 : : */
2724 : : RTE_FLOW_ACTION_TYPE_SECURITY,
2725 : :
2726 : : /**
2727 : : * @warning This is a legacy action.
2728 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2729 : : *
2730 : : * Implements OFPAT_DEC_NW_TTL ("decrement IP TTL") as defined by
2731 : : * the OpenFlow Switch Specification.
2732 : : *
2733 : : * No associated configuration structure.
2734 : : */
2735 : : RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
2736 : :
2737 : : /**
2738 : : * Implements OFPAT_POP_VLAN ("pop the outer VLAN tag") as defined
2739 : : * by the OpenFlow Switch Specification.
2740 : : *
2741 : : * No associated configuration structure.
2742 : : */
2743 : : RTE_FLOW_ACTION_TYPE_OF_POP_VLAN,
2744 : :
2745 : : /**
2746 : : * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by
2747 : : * the OpenFlow Switch Specification.
2748 : : *
2749 : : * See struct rte_flow_action_of_push_vlan.
2750 : : */
2751 : : RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
2752 : :
2753 : : /**
2754 : : * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as
2755 : : * defined by the OpenFlow Switch Specification.
2756 : : *
2757 : : * See struct rte_flow_action_of_set_vlan_vid.
2758 : : */
2759 : : RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID,
2760 : :
2761 : : /**
2762 : : * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as
2763 : : * defined by the OpenFlow Switch Specification.
2764 : : *
2765 : : * See struct rte_flow_action_of_set_vlan_pcp.
2766 : : */
2767 : : RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP,
2768 : :
2769 : : /**
2770 : : * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined
2771 : : * by the OpenFlow Switch Specification.
2772 : : *
2773 : : * See struct rte_flow_action_of_pop_mpls.
2774 : : */
2775 : : RTE_FLOW_ACTION_TYPE_OF_POP_MPLS,
2776 : :
2777 : : /**
2778 : : * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by
2779 : : * the OpenFlow Switch Specification.
2780 : : *
2781 : : * See struct rte_flow_action_of_push_mpls.
2782 : : */
2783 : : RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS,
2784 : :
2785 : : /**
2786 : : * Encapsulate flow in VXLAN tunnel as defined in
2787 : : * rte_flow_action_vxlan_encap action structure.
2788 : : *
2789 : : * See struct rte_flow_action_vxlan_encap.
2790 : : */
2791 : : RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP,
2792 : :
2793 : : /**
2794 : : * Decapsulate outer most VXLAN tunnel from matched flow.
2795 : : *
2796 : : * If flow pattern does not define a valid VXLAN tunnel (as specified by
2797 : : * RFC7348) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2798 : : * error.
2799 : : */
2800 : : RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
2801 : :
2802 : : /**
2803 : : * Encapsulate flow in NVGRE tunnel defined in the
2804 : : * rte_flow_action_nvgre_encap action structure.
2805 : : *
2806 : : * See struct rte_flow_action_nvgre_encap.
2807 : : */
2808 : : RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP,
2809 : :
2810 : : /**
2811 : : * Decapsulate outer most NVGRE tunnel from matched flow.
2812 : : *
2813 : : * If flow pattern does not define a valid NVGRE tunnel (as specified by
2814 : : * RFC7637) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
2815 : : * error.
2816 : : */
2817 : : RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
2818 : :
2819 : : /**
2820 : : * Add outer header whose template is provided in its data buffer
2821 : : *
2822 : : * See struct rte_flow_action_raw_encap.
2823 : : */
2824 : : RTE_FLOW_ACTION_TYPE_RAW_ENCAP,
2825 : :
2826 : : /**
2827 : : * Remove outer header whose template is provided in its data buffer.
2828 : : *
2829 : : * See struct rte_flow_action_raw_decap
2830 : : */
2831 : : RTE_FLOW_ACTION_TYPE_RAW_DECAP,
2832 : :
2833 : : /**
2834 : : * @warning This is a legacy action.
2835 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2836 : : *
2837 : : * Modify IPv4 source address in the outermost IPv4 header.
2838 : : *
2839 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2840 : : * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2841 : : *
2842 : : * See struct rte_flow_action_set_ipv4.
2843 : : */
2844 : : RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC,
2845 : :
2846 : : /**
2847 : : * @warning This is a legacy action.
2848 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2849 : : *
2850 : : * Modify IPv4 destination address in the outermost IPv4 header.
2851 : : *
2852 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
2853 : : * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2854 : : *
2855 : : * See struct rte_flow_action_set_ipv4.
2856 : : */
2857 : : RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,
2858 : :
2859 : : /**
2860 : : * @warning This is a legacy action.
2861 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2862 : : *
2863 : : * Modify IPv6 source address in the outermost IPv6 header.
2864 : : *
2865 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2866 : : * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2867 : : *
2868 : : * See struct rte_flow_action_set_ipv6.
2869 : : */
2870 : : RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC,
2871 : :
2872 : : /**
2873 : : * @warning This is a legacy action.
2874 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2875 : : *
2876 : : * Modify IPv6 destination address in the outermost IPv6 header.
2877 : : *
2878 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
2879 : : * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2880 : : *
2881 : : * See struct rte_flow_action_set_ipv6.
2882 : : */
2883 : : RTE_FLOW_ACTION_TYPE_SET_IPV6_DST,
2884 : :
2885 : : /**
2886 : : * @warning This is a legacy action.
2887 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2888 : : *
2889 : : * Modify source port number in the outermost TCP/UDP header.
2890 : : *
2891 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2892 : : * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2893 : : * RTE_FLOW_ERROR_TYPE_ACTION error.
2894 : : *
2895 : : * See struct rte_flow_action_set_tp.
2896 : : */
2897 : : RTE_FLOW_ACTION_TYPE_SET_TP_SRC,
2898 : :
2899 : : /**
2900 : : * @warning This is a legacy action.
2901 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2902 : : *
2903 : : * Modify destination port number in the outermost TCP/UDP header.
2904 : : *
2905 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
2906 : : * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
2907 : : * RTE_FLOW_ERROR_TYPE_ACTION error.
2908 : : *
2909 : : * See struct rte_flow_action_set_tp.
2910 : : */
2911 : : RTE_FLOW_ACTION_TYPE_SET_TP_DST,
2912 : :
2913 : : /**
2914 : : * Swap the source and destination MAC addresses in the outermost
2915 : : * Ethernet header.
2916 : : *
2917 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2918 : : * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2919 : : *
2920 : : * No associated configuration structure.
2921 : : */
2922 : : RTE_FLOW_ACTION_TYPE_MAC_SWAP,
2923 : :
2924 : : /**
2925 : : * @warning This is a legacy action.
2926 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2927 : : *
2928 : : * Decrease TTL value directly
2929 : : *
2930 : : * No associated configuration structure.
2931 : : */
2932 : : RTE_FLOW_ACTION_TYPE_DEC_TTL,
2933 : :
2934 : : /**
2935 : : * @warning This is a legacy action.
2936 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2937 : : *
2938 : : * Set TTL value
2939 : : *
2940 : : * See struct rte_flow_action_set_ttl
2941 : : */
2942 : : RTE_FLOW_ACTION_TYPE_SET_TTL,
2943 : :
2944 : : /**
2945 : : * @warning This is a legacy action.
2946 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2947 : : *
2948 : : * Set source MAC address from matched flow.
2949 : : *
2950 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2951 : : * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2952 : : *
2953 : : * See struct rte_flow_action_set_mac.
2954 : : */
2955 : : RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
2956 : :
2957 : : /**
2958 : : * @warning This is a legacy action.
2959 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2960 : : *
2961 : : * Set destination MAC address from matched flow.
2962 : : *
2963 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
2964 : : * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
2965 : : *
2966 : : * See struct rte_flow_action_set_mac.
2967 : : */
2968 : : RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
2969 : :
2970 : : /**
2971 : : * @warning This is a legacy action.
2972 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2973 : : *
2974 : : * Increase sequence number in the outermost TCP header.
2975 : : *
2976 : : * Action configuration specifies the value to increase
2977 : : * TCP sequence number as a big-endian 32 bit integer.
2978 : : *
2979 : : * @p conf type:
2980 : : * @code rte_be32_t * @endcode
2981 : : *
2982 : : * Using this action on non-matching traffic will result in
2983 : : * undefined behavior.
2984 : : */
2985 : : RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ,
2986 : :
2987 : : /**
2988 : : * @warning This is a legacy action.
2989 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2990 : : *
2991 : : * Decrease sequence number in the outermost TCP header.
2992 : : *
2993 : : * Action configuration specifies the value to decrease
2994 : : * TCP sequence number as a big-endian 32 bit integer.
2995 : : *
2996 : : * @p conf type:
2997 : : * @code rte_be32_t * @endcode
2998 : : *
2999 : : * Using this action on non-matching traffic will result in
3000 : : * undefined behavior.
3001 : : */
3002 : : RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ,
3003 : :
3004 : : /**
3005 : : * @warning This is a legacy action.
3006 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3007 : : *
3008 : : * Increase acknowledgment number in the outermost TCP header.
3009 : : *
3010 : : * Action configuration specifies the value to increase
3011 : : * TCP acknowledgment number as a big-endian 32 bit integer.
3012 : : *
3013 : : * @p conf type:
3014 : : * @code rte_be32_t * @endcode
3015 : :
3016 : : * Using this action on non-matching traffic will result in
3017 : : * undefined behavior.
3018 : : */
3019 : : RTE_FLOW_ACTION_TYPE_INC_TCP_ACK,
3020 : :
3021 : : /**
3022 : : * @warning This is a legacy action.
3023 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3024 : : *
3025 : : * Decrease acknowledgment number in the outermost TCP header.
3026 : : *
3027 : : * Action configuration specifies the value to decrease
3028 : : * TCP acknowledgment number as a big-endian 32 bit integer.
3029 : : *
3030 : : * @p conf type:
3031 : : * @code rte_be32_t * @endcode
3032 : : *
3033 : : * Using this action on non-matching traffic will result in
3034 : : * undefined behavior.
3035 : : */
3036 : : RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK,
3037 : :
3038 : : /**
3039 : : * @warning This is a legacy action.
3040 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3041 : : *
3042 : : * Set Tag.
3043 : : *
3044 : : * Tag is for internal flow usage only and
3045 : : * is not delivered to the application.
3046 : : *
3047 : : * See struct rte_flow_action_set_tag.
3048 : : */
3049 : : RTE_FLOW_ACTION_TYPE_SET_TAG,
3050 : :
3051 : : /**
3052 : : * @warning This is a legacy action.
3053 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3054 : : *
3055 : : * Set metadata on ingress or egress path.
3056 : : *
3057 : : * See struct rte_flow_action_set_meta.
3058 : : */
3059 : : RTE_FLOW_ACTION_TYPE_SET_META,
3060 : :
3061 : : /**
3062 : : * @warning This is a legacy action.
3063 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3064 : : *
3065 : : * Modify IPv4 DSCP in the outermost IP header.
3066 : : *
3067 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
3068 : : * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
3069 : : *
3070 : : * See struct rte_flow_action_set_dscp.
3071 : : */
3072 : : RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP,
3073 : :
3074 : : /**
3075 : : * @warning This is a legacy action.
3076 : : * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3077 : : *
3078 : : * Modify IPv6 DSCP in the outermost IP header.
3079 : : *
3080 : : * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
3081 : : * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
3082 : : *
3083 : : * See struct rte_flow_action_set_dscp.
3084 : : */
3085 : : RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP,
3086 : :
3087 : : /**
3088 : : * Report as aged flow if timeout passed without any matching on the
3089 : : * flow.
3090 : : *
3091 : : * See struct rte_flow_action_age.
3092 : : * See function rte_flow_get_q_aged_flows
3093 : : * See function rte_flow_get_aged_flows
3094 : : * see enum RTE_ETH_EVENT_FLOW_AGED
3095 : : * See struct rte_flow_query_age
3096 : : * See struct rte_flow_update_age
3097 : : */
3098 : : RTE_FLOW_ACTION_TYPE_AGE,
3099 : :
3100 : : /**
3101 : : * The matching packets will be duplicated with specified ratio and
3102 : : * applied with own set of actions with a fate action.
3103 : : *
3104 : : * See struct rte_flow_action_sample.
3105 : : */
3106 : : RTE_FLOW_ACTION_TYPE_SAMPLE,
3107 : :
3108 : : /**
3109 : : * @deprecated
3110 : : * @see RTE_FLOW_ACTION_TYPE_INDIRECT
3111 : : *
3112 : : * Describe action shared across multiple flow rules.
3113 : : *
3114 : : * Allow multiple rules reference the same action by handle (see
3115 : : * struct rte_flow_shared_action).
3116 : : */
3117 : : RTE_FLOW_ACTION_TYPE_SHARED,
3118 : :
3119 : : /**
3120 : : * Modify a packet header field, tag, mark or metadata.
3121 : : *
3122 : : * Allow the modification of an arbitrary header field via
3123 : : * set, add and sub operations or copying its content into
3124 : : * tag, meta or mark for future processing.
3125 : : *
3126 : : * See struct rte_flow_action_modify_field.
3127 : : */
3128 : : RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
3129 : :
3130 : : /**
3131 : : * An action handle is referenced in a rule through an indirect action.
3132 : : *
3133 : : * The same action handle may be used in multiple rules for the same
3134 : : * or different ethdev ports.
3135 : : */
3136 : : RTE_FLOW_ACTION_TYPE_INDIRECT,
3137 : :
3138 : : /**
3139 : : * [META]
3140 : : *
3141 : : * Enable tracking a TCP connection state.
3142 : : *
3143 : : * @see struct rte_flow_action_conntrack.
3144 : : */
3145 : : RTE_FLOW_ACTION_TYPE_CONNTRACK,
3146 : :
3147 : : /**
3148 : : * Color the packet to reflect the meter color result.
3149 : : * Set the meter color in the mbuf to the selected color.
3150 : : *
3151 : : * See struct rte_flow_action_meter_color.
3152 : : */
3153 : : RTE_FLOW_ACTION_TYPE_METER_COLOR,
3154 : :
3155 : : /**
3156 : : * At embedded switch level, sends matching traffic to the given ethdev.
3157 : : *
3158 : : * @see struct rte_flow_action_ethdev
3159 : : */
3160 : : RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
3161 : :
3162 : : /**
3163 : : * At embedded switch level, send matching traffic to
3164 : : * the entity represented by the given ethdev.
3165 : : *
3166 : : * @see struct rte_flow_action_ethdev
3167 : : */
3168 : : RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
3169 : :
3170 : : /**
3171 : : * Traffic metering and marking (MTR).
3172 : : *
3173 : : * @see struct rte_flow_action_meter_mark
3174 : : * See file rte_mtr.h for MTR profile object configuration.
3175 : : */
3176 : : RTE_FLOW_ACTION_TYPE_METER_MARK,
3177 : :
3178 : : /**
3179 : : * Send packets to the kernel, without going to userspace at all.
3180 : : * The packets will be received by the kernel driver sharing
3181 : : * the same device as the DPDK port on which this action is configured.
3182 : : * This action mostly suits bifurcated driver model.
3183 : : *
3184 : : * No associated configuration structure.
3185 : : */
3186 : : RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL,
3187 : :
3188 : : /**
3189 : : * Apply the quota verdict (PASS or BLOCK) to a flow.
3190 : : *
3191 : : * @see struct rte_flow_action_quota
3192 : : * @see struct rte_flow_query_quota
3193 : : * @see struct rte_flow_update_quota
3194 : : */
3195 : : RTE_FLOW_ACTION_TYPE_QUOTA,
3196 : :
3197 : : /**
3198 : : * Skip congestion management configuration.
3199 : : *
3200 : : * Using rte_eth_cman_config_set(), the application
3201 : : * can configure ethdev Rx queue's congestion mechanism.
3202 : : * This flow action allows to skip the congestion configuration
3203 : : * applied to the given ethdev Rx queue.
3204 : : */
3205 : : RTE_FLOW_ACTION_TYPE_SKIP_CMAN,
3206 : :
3207 : : /**
3208 : : * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH
3209 : : *
3210 : : * Push IPv6 extension into IPv6 packet.
3211 : : *
3212 : : * @see struct rte_flow_action_ipv6_ext_push.
3213 : : */
3214 : : RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH,
3215 : :
3216 : : /**
3217 : : * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE
3218 : : *
3219 : : * Remove IPv6 extension from IPv6 packet whose type
3220 : : * is provided in its configuration buffer.
3221 : : *
3222 : : * @see struct rte_flow_action_ipv6_ext_remove.
3223 : : */
3224 : : RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE,
3225 : :
3226 : : /**
3227 : : * Action handle to reference flow actions list.
3228 : : *
3229 : : * @see struct rte_flow_action_indirect_list
3230 : : */
3231 : : RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
3232 : :
3233 : : /**
3234 : : * Program action. These actions are defined by the program currently
3235 : : * loaded on the device. For example, these actions are applicable to
3236 : : * devices that can be programmed through the P4 language.
3237 : : *
3238 : : * @see struct rte_flow_action_prog.
3239 : : */
3240 : : RTE_FLOW_ACTION_TYPE_PROG,
3241 : :
3242 : : /**
3243 : : * NAT64 translation of IPv4/IPv6 headers.
3244 : : *
3245 : : * @see struct rte_flow_action_nat64
3246 : : */
3247 : : RTE_FLOW_ACTION_TYPE_NAT64,
3248 : : };
3249 : :
3250 : : /**
3251 : : * @warning
3252 : : * @b EXPERIMENTAL: this API may change without prior notice.
3253 : : *
3254 : : * QUOTA operational mode.
3255 : : *
3256 : : * @see struct rte_flow_action_quota
3257 : : */
3258 : : enum rte_flow_quota_mode {
3259 : : RTE_FLOW_QUOTA_MODE_PACKET = 1, /**< Count packets. */
3260 : : RTE_FLOW_QUOTA_MODE_L2 = 2, /**< Count packet bytes starting from L2. */
3261 : : RTE_FLOW_QUOTA_MODE_L3 = 3, /**< Count packet bytes starting from L3. */
3262 : : };
3263 : :
3264 : : /**
3265 : : * @warning
3266 : : * @b EXPERIMENTAL: this API may change without prior notice.
3267 : : *
3268 : : * Create QUOTA action.
3269 : : *
3270 : : * @see RTE_FLOW_ACTION_TYPE_QUOTA
3271 : : */
3272 : : struct rte_flow_action_quota {
3273 : : enum rte_flow_quota_mode mode; /**< Quota operational mode. */
3274 : : int64_t quota; /**< Quota value. */
3275 : : };
3276 : :
3277 : : /**
3278 : : * @warning
3279 : : * @b EXPERIMENTAL: this API may change without prior notice.
3280 : : *
3281 : : * Query indirect QUOTA action.
3282 : : *
3283 : : * @see RTE_FLOW_ACTION_TYPE_QUOTA
3284 : : */
3285 : : struct rte_flow_query_quota {
3286 : : int64_t quota; /**< Quota value. */
3287 : : };
3288 : :
3289 : : /**
3290 : : * @warning
3291 : : * @b EXPERIMENTAL: this API may change without prior notice.
3292 : : *
3293 : : * Indirect QUOTA update operations.
3294 : : *
3295 : : * @see struct rte_flow_update_quota
3296 : : */
3297 : : enum rte_flow_update_quota_op {
3298 : : RTE_FLOW_UPDATE_QUOTA_SET, /**< Set new quota value. */
3299 : : RTE_FLOW_UPDATE_QUOTA_ADD, /**< Increase quota value. */
3300 : : };
3301 : :
3302 : : /**
3303 : : * @warning
3304 : : * @b EXPERIMENTAL: this API may change without prior notice.
3305 : : *
3306 : : * @see RTE_FLOW_ACTION_TYPE_QUOTA
3307 : : *
3308 : : * Update indirect QUOTA action.
3309 : : */
3310 : : struct rte_flow_update_quota {
3311 : : enum rte_flow_update_quota_op op; /**< Update operation. */
3312 : : int64_t quota; /**< Quota value. */
3313 : : };
3314 : :
3315 : : /**
3316 : : * RTE_FLOW_ACTION_TYPE_MARK
3317 : : *
3318 : : * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
3319 : : * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
3320 : : *
3321 : : * This value is arbitrary and application-defined. Maximum allowed value
3322 : : * depends on the underlying implementation. It is returned in the
3323 : : * hash.fdir.hi mbuf field.
3324 : : */
3325 : : struct rte_flow_action_mark {
3326 : : uint32_t id; /**< Integer value to return with packets. */
3327 : : };
3328 : :
3329 : : /**
3330 : : * @warning
3331 : : * @b EXPERIMENTAL: this structure may change without prior notice
3332 : : *
3333 : : * RTE_FLOW_ACTION_TYPE_JUMP
3334 : : *
3335 : : * Redirects packets to a group on the current device.
3336 : : *
3337 : : * In a hierarchy of groups, which can be used to represent physical or logical
3338 : : * flow tables on the device, this action allows the action to be a redirect to
3339 : : * a group on that device.
3340 : : */
3341 : : struct rte_flow_action_jump {
3342 : : uint32_t group;
3343 : : };
3344 : :
3345 : : /**
3346 : : * RTE_FLOW_ACTION_TYPE_QUEUE
3347 : : *
3348 : : * Assign packets to a given queue index.
3349 : : */
3350 : : struct rte_flow_action_queue {
3351 : : uint16_t index; /**< Queue index to use. */
3352 : : };
3353 : :
3354 : : /**
3355 : : * @warning
3356 : : * @b EXPERIMENTAL: this structure may change without prior notice
3357 : : *
3358 : : * RTE_FLOW_ACTION_TYPE_AGE
3359 : : *
3360 : : * Report flow as aged-out if timeout passed without any matching
3361 : : * on the flow. RTE_ETH_EVENT_FLOW_AGED event is triggered when a
3362 : : * port detects new aged-out flows.
3363 : : *
3364 : : * The flow context and the flow handle will be reported by the either
3365 : : * rte_flow_get_aged_flows or rte_flow_get_q_aged_flows APIs.
3366 : : */
3367 : : struct rte_flow_action_age {
3368 : : uint32_t timeout:24; /**< Time in seconds. */
3369 : : uint32_t reserved:8; /**< Reserved, must be zero. */
3370 : : /** The user flow context, NULL means the rte_flow pointer. */
3371 : : void *context;
3372 : : };
3373 : :
3374 : : /**
3375 : : * RTE_FLOW_ACTION_TYPE_AGE (query)
3376 : : *
3377 : : * Query structure to retrieve the aging status information of a
3378 : : * shared AGE action, or a flow rule using the AGE action.
3379 : : */
3380 : : struct rte_flow_query_age {
3381 : : uint32_t reserved:6; /**< Reserved, must be zero. */
3382 : : uint32_t aged:1; /**< 1 if aging timeout expired, 0 otherwise. */
3383 : : /** sec_since_last_hit value is valid. */
3384 : : uint32_t sec_since_last_hit_valid:1;
3385 : : uint32_t sec_since_last_hit:24; /**< Seconds since last traffic hit. */
3386 : : };
3387 : :
3388 : : /**
3389 : : * @warning
3390 : : * @b EXPERIMENTAL: this structure may change without prior notice
3391 : : *
3392 : : * RTE_FLOW_ACTION_TYPE_AGE
3393 : : *
3394 : : * Update indirect AGE action attributes:
3395 : : * - Timeout can be updated including stop/start action:
3396 : : * +-------------+-------------+------------------------------+
3397 : : * | Old Timeout | New Timeout | Updating |
3398 : : * +=============+=============+==============================+
3399 : : * | 0 | positive | Start aging with new value |
3400 : : * +-------------+-------------+------------------------------+
3401 : : * | positive | 0 | Stop aging |
3402 : : * +-------------+-------------+------------------------------+
3403 : : * | positive | positive | Change timeout to new value |
3404 : : * +-------------+-------------+------------------------------+
3405 : : * - sec_since_last_hit can be reset.
3406 : : */
3407 : : struct rte_flow_update_age {
3408 : : uint32_t reserved:6; /**< Reserved, must be zero. */
3409 : : uint32_t timeout_valid:1; /**< The timeout is valid for update. */
3410 : : uint32_t timeout:24; /**< Time in seconds. */
3411 : : /** Means that aging should assume packet passed the aging. */
3412 : : uint32_t touch:1;
3413 : : };
3414 : :
3415 : : /**
3416 : : * @warning
3417 : : * @b EXPERIMENTAL: this structure may change without prior notice
3418 : : *
3419 : : * RTE_FLOW_ACTION_TYPE_COUNT
3420 : : *
3421 : : * Adds a counter action to a matched flow.
3422 : : *
3423 : : * If more than one count action is specified in a single flow rule, then each
3424 : : * action must specify a unique ID.
3425 : : *
3426 : : * Counters can be retrieved and reset through ``rte_flow_query()``, see
3427 : : * ``struct rte_flow_query_count``.
3428 : : *
3429 : : * For ports within the same switch domain then the counter ID namespace extends
3430 : : * to all ports within that switch domain.
3431 : : */
3432 : : struct rte_flow_action_count {
3433 : : uint32_t id; /**< Counter ID. */
3434 : : };
3435 : :
3436 : : /**
3437 : : * RTE_FLOW_ACTION_TYPE_COUNT (query)
3438 : : *
3439 : : * Query structure to retrieve and reset flow rule counters.
3440 : : */
3441 : : struct rte_flow_query_count {
3442 : : uint32_t reset:1; /**< Reset counters after query [in]. */
3443 : : uint32_t hits_set:1; /**< hits field is set [out]. */
3444 : : uint32_t bytes_set:1; /**< bytes field is set [out]. */
3445 : : uint32_t reserved:29; /**< Reserved, must be zero [in, out]. */
3446 : : uint64_t hits; /**< Number of hits for this rule [out]. */
3447 : : uint64_t bytes; /**< Number of bytes through this rule [out]. */
3448 : : };
3449 : :
3450 : : /**
3451 : : * RTE_FLOW_ACTION_TYPE_RSS
3452 : : *
3453 : : * Similar to QUEUE, except RSS is additionally performed on packets to
3454 : : * spread them among several queues according to the provided parameters.
3455 : : *
3456 : : * Unlike global RSS settings used by other DPDK APIs, unsetting the
3457 : : * @p types field does not disable RSS in a flow rule. Doing so instead
3458 : : * requests safe unspecified "best-effort" settings from the underlying PMD,
3459 : : * which depending on the flow rule, may result in anything ranging from
3460 : : * empty (single queue) to all-inclusive RSS.
3461 : : *
3462 : : * Note: RSS hash result is stored in the hash.rss mbuf field which overlaps
3463 : : * hash.fdir.lo. Since the MARK action sets the hash.fdir.hi field only,
3464 : : * both can be requested simultaneously.
3465 : : */
3466 : : struct rte_flow_action_rss {
3467 : : enum rte_eth_hash_function func; /**< RSS hash function to apply. */
3468 : : /**
3469 : : * Packet encapsulation level RSS hash @p types apply to.
3470 : : *
3471 : : * - @p 0 requests the default behavior. Depending on the packet
3472 : : * type, it can mean outermost, innermost, anything in between or
3473 : : * even no RSS.
3474 : : *
3475 : : * It basically stands for the innermost encapsulation level RSS
3476 : : * can be performed on according to PMD and device capabilities.
3477 : : *
3478 : : * - @p 1 requests RSS to be performed on the outermost packet
3479 : : * encapsulation level.
3480 : : *
3481 : : * - @p 2 and subsequent values request RSS to be performed on the
3482 : : * specified inner packet encapsulation level, from outermost to
3483 : : * innermost (lower to higher values).
3484 : : *
3485 : : * Values other than @p 0 are not necessarily supported.
3486 : : *
3487 : : * Requesting a specific RSS level on unrecognized traffic results
3488 : : * in undefined behavior. For predictable results, it is recommended
3489 : : * to make the flow rule pattern match packet headers up to the
3490 : : * requested encapsulation level so that only matching traffic goes
3491 : : * through.
3492 : : */
3493 : : uint32_t level;
3494 : : uint64_t types; /**< Specific RSS hash types (see RTE_ETH_RSS_*). */
3495 : : uint32_t key_len; /**< Hash key length in bytes. */
3496 : : uint32_t queue_num; /**< Number of entries in @p queue. */
3497 : : const uint8_t *key; /**< Hash key. */
3498 : : const uint16_t *queue; /**< Queue indices to use. */
3499 : : };
3500 : :
3501 : : /**
3502 : : * @deprecated
3503 : : * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
3504 : : * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
3505 : : *
3506 : : * RTE_FLOW_ACTION_TYPE_VF
3507 : : *
3508 : : * Directs matching traffic to a given virtual function of the current
3509 : : * device.
3510 : : *
3511 : : * Packets matched by a VF pattern item can be redirected to their original
3512 : : * VF ID instead of the specified one. This parameter may not be available
3513 : : * and is not guaranteed to work properly if the VF part is matched by a
3514 : : * prior flow rule or if packets are not addressed to a VF in the first
3515 : : * place.
3516 : : */
3517 : : struct rte_flow_action_vf {
3518 : : uint32_t original:1; /**< Use original VF ID if possible. */
3519 : : uint32_t reserved:31; /**< Reserved, must be zero. */
3520 : : uint32_t id; /**< VF ID. */
3521 : : };
3522 : :
3523 : : /**
3524 : : * @deprecated
3525 : : * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
3526 : : * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
3527 : : *
3528 : : * RTE_FLOW_ACTION_TYPE_PORT_ID
3529 : : *
3530 : : * Directs matching traffic to a given DPDK port ID.
3531 : : *
3532 : : * @see RTE_FLOW_ITEM_TYPE_PORT_ID
3533 : : */
3534 : : struct rte_flow_action_port_id {
3535 : : uint32_t original:1; /**< Use original DPDK port ID if possible. */
3536 : : uint32_t reserved:31; /**< Reserved, must be zero. */
3537 : : uint32_t id; /**< DPDK port ID. */
3538 : : };
3539 : :
3540 : : /**
3541 : : * RTE_FLOW_ACTION_TYPE_METER
3542 : : *
3543 : : * Traffic metering and policing (MTR).
3544 : : *
3545 : : * Packets matched by items of this type can be either dropped or passed to the
3546 : : * next item with their color set by the MTR object.
3547 : : */
3548 : : struct rte_flow_action_meter {
3549 : : uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */
3550 : : };
3551 : :
3552 : : /**
3553 : : * RTE_FLOW_ACTION_TYPE_SECURITY
3554 : : *
3555 : : * Perform the security action on flows matched by the pattern items
3556 : : * according to the configuration of the security session.
3557 : : *
3558 : : * This action modifies the payload of matched flows. For INLINE_CRYPTO, the
3559 : : * security protocol headers and IV are fully provided by the application as
3560 : : * specified in the flow pattern. The payload of matching packets is
3561 : : * encrypted on egress, and decrypted and authenticated on ingress.
3562 : : * For INLINE_PROTOCOL, the security protocol is fully offloaded to HW,
3563 : : * providing full encapsulation and decapsulation of packets in security
3564 : : * protocols. The flow pattern specifies both the outer security header fields
3565 : : * and the inner packet fields. The security session specified in the action
3566 : : * must match the pattern parameters.
3567 : : *
3568 : : * The security session specified in the action must be created on the same
3569 : : * port as the flow action that is being specified.
3570 : : *
3571 : : * The ingress/egress flow attribute should match that specified in the
3572 : : * security session if the security session supports the definition of the
3573 : : * direction.
3574 : : *
3575 : : * Multiple flows can be configured to use the same security session.
3576 : : *
3577 : : * The NULL value is allowed for security session. If security session is NULL,
3578 : : * then SPI field in ESP flow item and IP addresses in flow items 'IPv4' and
3579 : : * 'IPv6' will be allowed to be a range. The rule thus created can enable
3580 : : * security processing on multiple flows.
3581 : : */
3582 : : struct rte_flow_action_security {
3583 : : void *security_session; /**< Pointer to security session structure. */
3584 : : };
3585 : :
3586 : : /**
3587 : : * NAT64 translation type for IP headers.
3588 : : */
3589 : : enum rte_flow_nat64_type {
3590 : : RTE_FLOW_NAT64_6TO4 = 0, /**< IPv6 to IPv4 headers translation. */
3591 : : RTE_FLOW_NAT64_4TO6 = 1, /**< IPv4 to IPv6 headers translation. */
3592 : : };
3593 : :
3594 : : /**
3595 : : * @warning
3596 : : * @b EXPERIMENTAL: this structure may change without prior notice.
3597 : : *
3598 : : * RTE_FLOW_ACTION_TYPE_NAT64
3599 : : *
3600 : : * Specify the NAT64 translation type.
3601 : : */
3602 : : struct rte_flow_action_nat64 {
3603 : : enum rte_flow_nat64_type type;
3604 : : };
3605 : :
3606 : : /**
3607 : : * RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN
3608 : : *
3609 : : * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by the
3610 : : * OpenFlow Switch Specification.
3611 : : */
3612 : : struct rte_flow_action_of_push_vlan {
3613 : : rte_be16_t ethertype; /**< EtherType. */
3614 : : };
3615 : :
3616 : : /**
3617 : : * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID
3618 : : *
3619 : : * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as defined by
3620 : : * the OpenFlow Switch Specification.
3621 : : */
3622 : : struct rte_flow_action_of_set_vlan_vid {
3623 : : rte_be16_t vlan_vid; /**< VLAN ID. */
3624 : : };
3625 : :
3626 : : /**
3627 : : * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP
3628 : : *
3629 : : * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as defined by
3630 : : * the OpenFlow Switch Specification.
3631 : : */
3632 : : struct rte_flow_action_of_set_vlan_pcp {
3633 : : uint8_t vlan_pcp; /**< VLAN priority. */
3634 : : };
3635 : :
3636 : : /**
3637 : : * RTE_FLOW_ACTION_TYPE_OF_POP_MPLS
3638 : : *
3639 : : * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined by the
3640 : : * OpenFlow Switch Specification.
3641 : : */
3642 : : struct rte_flow_action_of_pop_mpls {
3643 : : rte_be16_t ethertype; /**< EtherType. */
3644 : : };
3645 : :
3646 : : /**
3647 : : * RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS
3648 : : *
3649 : : * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by the
3650 : : * OpenFlow Switch Specification.
3651 : : */
3652 : : struct rte_flow_action_of_push_mpls {
3653 : : rte_be16_t ethertype; /**< EtherType. */
3654 : : };
3655 : :
3656 : : /**
3657 : : * @warning
3658 : : * @b EXPERIMENTAL: this structure may change without prior notice
3659 : : *
3660 : : * RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP
3661 : : *
3662 : : * VXLAN tunnel end-point encapsulation data definition
3663 : : *
3664 : : * The tunnel definition is provided through the flow item pattern, the
3665 : : * provided pattern must conform to RFC7348 for the tunnel specified. The flow
3666 : : * definition must be provided in order from the RTE_FLOW_ITEM_TYPE_ETH
3667 : : * definition up the end item which is specified by RTE_FLOW_ITEM_TYPE_END.
3668 : : *
3669 : : * The mask field allows user to specify which fields in the flow item
3670 : : * definitions can be ignored and which have valid data and can be used
3671 : : * verbatim.
3672 : : *
3673 : : * Note: the last field is not used in the definition of a tunnel and can be
3674 : : * ignored.
3675 : : *
3676 : : * Valid flow definition for RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP include:
3677 : : *
3678 : : * - ETH / IPV4 / UDP / VXLAN / END
3679 : : * - ETH / IPV6 / UDP / VXLAN / END
3680 : : * - ETH / VLAN / IPV4 / UDP / VXLAN / END
3681 : : */
3682 : : struct rte_flow_action_vxlan_encap {
3683 : : /**
3684 : : * Encapsulating vxlan tunnel definition
3685 : : * (terminated by the END pattern item).
3686 : : */
3687 : : struct rte_flow_item *definition;
3688 : : };
3689 : :
3690 : : /**
3691 : : * @warning
3692 : : * @b EXPERIMENTAL: this structure may change without prior notice
3693 : : *
3694 : : * RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP
3695 : : *
3696 : : * NVGRE tunnel end-point encapsulation data definition
3697 : : *
3698 : : * The tunnel definition is provided through the flow item pattern the
3699 : : * provided pattern must conform with RFC7637. The flow definition must be
3700 : : * provided in order from the RTE_FLOW_ITEM_TYPE_ETH definition up the end item
3701 : : * which is specified by RTE_FLOW_ITEM_TYPE_END.
3702 : : *
3703 : : * The mask field allows user to specify which fields in the flow item
3704 : : * definitions can be ignored and which have valid data and can be used
3705 : : * verbatim.
3706 : : *
3707 : : * Note: the last field is not used in the definition of a tunnel and can be
3708 : : * ignored.
3709 : : *
3710 : : * Valid flow definition for RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP include:
3711 : : *
3712 : : * - ETH / IPV4 / NVGRE / END
3713 : : * - ETH / VLAN / IPV6 / NVGRE / END
3714 : : */
3715 : : struct rte_flow_action_nvgre_encap {
3716 : : /**
3717 : : * Encapsulating nvgre tunnel definition
3718 : : * (terminated by the END pattern item).
3719 : : */
3720 : : struct rte_flow_item *definition;
3721 : : };
3722 : :
3723 : : /**
3724 : : * @warning
3725 : : * @b EXPERIMENTAL: this structure may change without prior notice
3726 : : *
3727 : : * RTE_FLOW_ACTION_TYPE_RAW_ENCAP
3728 : : *
3729 : : * Raw tunnel end-point encapsulation data definition.
3730 : : *
3731 : : * The data holds the headers definitions to be applied on the packet.
3732 : : * The data must start with ETH header up to the tunnel item header itself.
3733 : : * When used right after RAW_DECAP (for decapsulating L3 tunnel type for
3734 : : * example MPLSoGRE) the data will just hold layer 2 header.
3735 : : *
3736 : : * The preserve parameter holds which bits in the packet the PMD is not allowed
3737 : : * to change, this parameter can also be NULL and then the PMD is allowed
3738 : : * to update any field.
3739 : : *
3740 : : * size holds the number of bytes in @p data and @p preserve.
3741 : : */
3742 : : struct rte_flow_action_raw_encap {
3743 : : uint8_t *data; /**< Encapsulation data. */
3744 : : uint8_t *preserve; /**< Bit-mask of @p data to preserve on output. */
3745 : : size_t size; /**< Size of @p data and @p preserve. */
3746 : : };
3747 : :
3748 : : /**
3749 : : * @warning
3750 : : * @b EXPERIMENTAL: this structure may change without prior notice
3751 : : *
3752 : : * RTE_FLOW_ACTION_TYPE_RAW_DECAP
3753 : : *
3754 : : * Raw tunnel end-point decapsulation data definition.
3755 : : *
3756 : : * The data holds the headers definitions to be removed from the packet.
3757 : : * The data must start with ETH header up to the tunnel item header itself.
3758 : : * When used right before RAW_DECAP (for encapsulating L3 tunnel type for
3759 : : * example MPLSoGRE) the data will just hold layer 2 header.
3760 : : *
3761 : : * size holds the number of bytes in @p data.
3762 : : */
3763 : : struct rte_flow_action_raw_decap {
3764 : : uint8_t *data; /**< Encapsulation data. */
3765 : : size_t size; /**< Size of @p data and @p preserve. */
3766 : : };
3767 : :
3768 : : /**
3769 : : * @warning
3770 : : * @b EXPERIMENTAL: this structure may change without prior notice
3771 : : *
3772 : : * RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
3773 : : * RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
3774 : : *
3775 : : * Allows modification of IPv4 source (RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC)
3776 : : * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) in the
3777 : : * specified outermost IPv4 header.
3778 : : */
3779 : : struct rte_flow_action_set_ipv4 {
3780 : : rte_be32_t ipv4_addr;
3781 : : };
3782 : :
3783 : : /**
3784 : : * @warning
3785 : : * @b EXPERIMENTAL: this structure may change without prior notice
3786 : : *
3787 : : * RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
3788 : : * RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
3789 : : *
3790 : : * Allows modification of IPv6 source (RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC)
3791 : : * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) in the
3792 : : * specified outermost IPv6 header.
3793 : : */
3794 : : struct rte_flow_action_set_ipv6 {
3795 : : uint8_t ipv6_addr[16];
3796 : : };
3797 : :
3798 : : /**
3799 : : * @warning
3800 : : * @b EXPERIMENTAL: this structure may change without prior notice.
3801 : : *
3802 : : * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH
3803 : : *
3804 : : * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH include:
3805 : : *
3806 : : * - IPV6_EXT TYPE / IPV6_EXT_HEADER_IN_TYPE / END
3807 : : *
3808 : : * The data must be added as the last IPv6 extension.
3809 : : */
3810 : : struct rte_flow_action_ipv6_ext_push {
3811 : : uint8_t *data; /**< IPv6 extension header data. */
3812 : : size_t size; /**< Size (in bytes) of @p data. */
3813 : : uint8_t type; /**< Type of IPv6 extension. */
3814 : : };
3815 : :
3816 : : /**
3817 : : * @warning
3818 : : * @b EXPERIMENTAL: this structure may change without prior notice.
3819 : : *
3820 : : * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE
3821 : : *
3822 : : * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE include:
3823 : : *
3824 : : * - IPV6_EXT TYPE / END
3825 : : */
3826 : : struct rte_flow_action_ipv6_ext_remove {
3827 : : uint8_t type; /**< Type of IPv6 extension. */
3828 : : };
3829 : :
3830 : : /**
3831 : : * @warning
3832 : : * @b EXPERIMENTAL: this structure may change without prior notice
3833 : : *
3834 : : * RTE_FLOW_ACTION_TYPE_SET_TP_SRC
3835 : : * RTE_FLOW_ACTION_TYPE_SET_TP_DST
3836 : : *
3837 : : * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC)
3838 : : * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers
3839 : : * in the specified outermost TCP/UDP header.
3840 : : */
3841 : : struct rte_flow_action_set_tp {
3842 : : rte_be16_t port;
3843 : : };
3844 : :
3845 : : /**
3846 : : * RTE_FLOW_ACTION_TYPE_SET_TTL
3847 : : *
3848 : : * Set the TTL value directly for IPv4 or IPv6
3849 : : */
3850 : : struct rte_flow_action_set_ttl {
3851 : : uint8_t ttl_value;
3852 : : };
3853 : :
3854 : : /**
3855 : : * RTE_FLOW_ACTION_TYPE_SET_MAC
3856 : : *
3857 : : * Set MAC address from the matched flow
3858 : : */
3859 : : struct rte_flow_action_set_mac {
3860 : : uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
3861 : : };
3862 : :
3863 : : /**
3864 : : * @warning
3865 : : * @b EXPERIMENTAL: this structure may change without prior notice
3866 : : *
3867 : : * RTE_FLOW_ACTION_TYPE_SET_TAG
3868 : : *
3869 : : * Set a tag which is a transient data used during flow matching. This is not
3870 : : * delivered to application. Multiple tags are supported by specifying index.
3871 : : */
3872 : : struct rte_flow_action_set_tag {
3873 : : uint32_t data;
3874 : : uint32_t mask;
3875 : : uint8_t index;
3876 : : };
3877 : :
3878 : : /**
3879 : : * @warning
3880 : : * @b EXPERIMENTAL: this structure may change without prior notice
3881 : : *
3882 : : * RTE_FLOW_ACTION_TYPE_SET_META
3883 : : *
3884 : : * Set metadata. Metadata set by mbuf metadata dynamic field with
3885 : : * RTE_MBUF_DYNFLAG_TX_METADATA flag on egress will be overridden by this
3886 : : * action. On ingress, the metadata will be carried by mbuf metadata dynamic
3887 : : * field with RTE_MBUF_DYNFLAG_RX_METADATA flag if set. The dynamic mbuf field
3888 : : * must be registered in advance by rte_flow_dynf_metadata_register().
3889 : : *
3890 : : * Altering partial bits is supported with mask. For bits which have never
3891 : : * been set, unpredictable value will be seen depending on driver
3892 : : * implementation. For loopback/hairpin packet, metadata set on Rx/Tx may
3893 : : * or may not be propagated to the other path depending on HW capability.
3894 : : *
3895 : : * RTE_FLOW_ITEM_TYPE_META matches metadata.
3896 : : */
3897 : : struct rte_flow_action_set_meta {
3898 : : uint32_t data;
3899 : : uint32_t mask;
3900 : : };
3901 : :
3902 : : /**
3903 : : * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
3904 : : * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
3905 : : *
3906 : : * Set the DSCP value for IPv4/IPv6 header.
3907 : : * DSCP in low 6 bits, rest ignored.
3908 : : */
3909 : : struct rte_flow_action_set_dscp {
3910 : : uint8_t dscp;
3911 : : };
3912 : :
3913 : : /**
3914 : : * @warning
3915 : : * @b EXPERIMENTAL: this structure may change without prior notice
3916 : : *
3917 : : * RTE_FLOW_ACTION_TYPE_INDIRECT
3918 : : *
3919 : : * Opaque type returned after successfully creating an indirect action object.
3920 : : * The definition of the object handle is different per driver or
3921 : : * per direct action type.
3922 : : *
3923 : : * This handle can be used to manage and query the related direct action:
3924 : : * - referenced in single flow rule or across multiple flow rules
3925 : : * over multiple ports
3926 : : * - update action object configuration
3927 : : * - query action object data
3928 : : * - destroy action object
3929 : : */
3930 : : struct rte_flow_action_handle;
3931 : :
3932 : : /**
3933 : : * The state of a TCP connection.
3934 : : */
3935 : : enum rte_flow_conntrack_state {
3936 : : /** SYN-ACK packet was seen. */
3937 : : RTE_FLOW_CONNTRACK_STATE_SYN_RECV,
3938 : : /** 3-way handshake was done. */
3939 : : RTE_FLOW_CONNTRACK_STATE_ESTABLISHED,
3940 : : /** First FIN packet was received to close the connection. */
3941 : : RTE_FLOW_CONNTRACK_STATE_FIN_WAIT,
3942 : : /** First FIN was ACKed. */
3943 : : RTE_FLOW_CONNTRACK_STATE_CLOSE_WAIT,
3944 : : /** Second FIN was received, waiting for the last ACK. */
3945 : : RTE_FLOW_CONNTRACK_STATE_LAST_ACK,
3946 : : /** Second FIN was ACKed, connection was closed. */
3947 : : RTE_FLOW_CONNTRACK_STATE_TIME_WAIT,
3948 : : };
3949 : :
3950 : : /**
3951 : : * The last passed TCP packet flags of a connection.
3952 : : */
3953 : : enum rte_flow_conntrack_tcp_last_index {
3954 : : RTE_FLOW_CONNTRACK_FLAG_NONE = 0, /**< No Flag. */
3955 : : RTE_FLOW_CONNTRACK_FLAG_SYN = RTE_BIT32(0), /**< With SYN flag. */
3956 : : RTE_FLOW_CONNTRACK_FLAG_SYNACK = RTE_BIT32(1), /**< With SYNACK flag. */
3957 : : RTE_FLOW_CONNTRACK_FLAG_FIN = RTE_BIT32(2), /**< With FIN flag. */
3958 : : RTE_FLOW_CONNTRACK_FLAG_ACK = RTE_BIT32(3), /**< With ACK flag. */
3959 : : RTE_FLOW_CONNTRACK_FLAG_RST = RTE_BIT32(4), /**< With RST flag. */
3960 : : };
3961 : :
3962 : : /**
3963 : : * @warning
3964 : : * @b EXPERIMENTAL: this structure may change without prior notice
3965 : : *
3966 : : * Configuration parameters for each direction of a TCP connection.
3967 : : * All fields should be in host byte order.
3968 : : * If needed, driver should convert all fields to network byte order
3969 : : * if HW needs them in that way.
3970 : : */
3971 : : struct rte_flow_tcp_dir_param {
3972 : : /** TCP window scaling factor, 0xF to disable. */
3973 : : uint32_t scale:4;
3974 : : /** The FIN was sent by this direction. */
3975 : : uint32_t close_initiated:1;
3976 : : /** An ACK packet has been received by this side. */
3977 : : uint32_t last_ack_seen:1;
3978 : : /**
3979 : : * If set, it indicates that there is unacknowledged data for the
3980 : : * packets sent from this direction.
3981 : : */
3982 : : uint32_t data_unacked:1;
3983 : : /**
3984 : : * Maximal value of sequence + payload length in sent
3985 : : * packets (next ACK from the opposite direction).
3986 : : */
3987 : : uint32_t sent_end;
3988 : : /**
3989 : : * Maximal value of (ACK + window size) in received packet + length
3990 : : * over sent packet (maximal sequence could be sent).
3991 : : */
3992 : : uint32_t reply_end;
3993 : : /** Maximal value of actual window size in sent packets. */
3994 : : uint32_t max_win;
3995 : : /** Maximal value of ACK in sent packets. */
3996 : : uint32_t max_ack;
3997 : : };
3998 : :
3999 : : /**
4000 : : * @warning
4001 : : * @b EXPERIMENTAL: this structure may change without prior notice
4002 : : *
4003 : : * RTE_FLOW_ACTION_TYPE_CONNTRACK
4004 : : *
4005 : : * Configuration and initial state for the connection tracking module.
4006 : : * This structure could be used for both setting and query.
4007 : : * All fields should be in host byte order.
4008 : : */
4009 : : struct rte_flow_action_conntrack {
4010 : : /** The peer port number, can be the same port. */
4011 : : uint16_t peer_port;
4012 : : /**
4013 : : * Direction of this connection when creating a flow rule, the
4014 : : * value only affects the creation of subsequent flow rules.
4015 : : */
4016 : : uint32_t is_original_dir:1;
4017 : : /**
4018 : : * Enable / disable the conntrack HW module. When disabled, the
4019 : : * result will always be RTE_FLOW_CONNTRACK_FLAG_DISABLED.
4020 : : * In this state the HW will act as passthrough.
4021 : : * It only affects this conntrack object in the HW without any effect
4022 : : * to the other objects.
4023 : : */
4024 : : uint32_t enable:1;
4025 : : /** At least one ack was seen after the connection was established. */
4026 : : uint32_t live_connection:1;
4027 : : /** Enable selective ACK on this connection. */
4028 : : uint32_t selective_ack:1;
4029 : : /** A challenge ack has passed. */
4030 : : uint32_t challenge_ack_passed:1;
4031 : : /**
4032 : : * 1: The last packet is seen from the original direction.
4033 : : * 0: The last packet is seen from the reply direction.
4034 : : */
4035 : : uint32_t last_direction:1;
4036 : : /** No TCP check will be done except the state change. */
4037 : : uint32_t liberal_mode:1;
4038 : : /** The current state of this connection. */
4039 : : enum rte_flow_conntrack_state state;
4040 : : /** Scaling factor for maximal allowed ACK window. */
4041 : : uint8_t max_ack_window;
4042 : : /** Maximal allowed number of retransmission times. */
4043 : : uint8_t retransmission_limit;
4044 : : /** TCP parameters of the original direction. */
4045 : : struct rte_flow_tcp_dir_param original_dir;
4046 : : /** TCP parameters of the reply direction. */
4047 : : struct rte_flow_tcp_dir_param reply_dir;
4048 : : /** The window value of the last packet passed this conntrack. */
4049 : : uint16_t last_window;
4050 : : enum rte_flow_conntrack_tcp_last_index last_index;
4051 : : /** The sequence of the last packet passed this conntrack. */
4052 : : uint32_t last_seq;
4053 : : /** The acknowledgment of the last packet passed this conntrack. */
4054 : : uint32_t last_ack;
4055 : : /**
4056 : : * The total value ACK + payload length of the last packet
4057 : : * passed this conntrack.
4058 : : */
4059 : : uint32_t last_end;
4060 : : };
4061 : :
4062 : : /**
4063 : : * RTE_FLOW_ACTION_TYPE_CONNTRACK
4064 : : *
4065 : : * Wrapper structure for the context update interface.
4066 : : * Ports cannot support updating, and the only valid solution is to
4067 : : * destroy the old context and create a new one instead.
4068 : : */
4069 : : struct rte_flow_modify_conntrack {
4070 : : /** New connection tracking parameters to be updated. */
4071 : : struct rte_flow_action_conntrack new_ct;
4072 : : /** The direction field will be updated. */
4073 : : uint32_t direction:1;
4074 : : /** All the other fields except direction will be updated. */
4075 : : uint32_t state:1;
4076 : : /** Reserved bits for the future usage. */
4077 : : uint32_t reserved:30;
4078 : : };
4079 : :
4080 : : /**
4081 : : * @warning
4082 : : * @b EXPERIMENTAL: this structure may change without prior notice
4083 : : *
4084 : : * RTE_FLOW_ACTION_TYPE_METER_COLOR
4085 : : *
4086 : : * The meter color should be set in the packet meta-data
4087 : : * (i.e. struct rte_mbuf::sched::color).
4088 : : */
4089 : : struct rte_flow_action_meter_color {
4090 : : enum rte_color color; /**< Packet color. */
4091 : : };
4092 : :
4093 : : /**
4094 : : * Provides an ethdev port ID for use with the following actions:
4095 : : * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
4096 : : * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT.
4097 : : */
4098 : : struct rte_flow_action_ethdev {
4099 : : uint16_t port_id; /**< ethdev port ID */
4100 : : };
4101 : :
4102 : : /**
4103 : : * Operation types for MODIFY_FIELD action.
4104 : : */
4105 : : enum rte_flow_modify_op {
4106 : : RTE_FLOW_MODIFY_SET = 0, /**< Set a new value. */
4107 : : RTE_FLOW_MODIFY_ADD, /**< Add a value to a field. */
4108 : : RTE_FLOW_MODIFY_SUB, /**< Subtract a value from a field. */
4109 : : };
4110 : :
4111 : : /**
4112 : : * @warning
4113 : : * @b EXPERIMENTAL: this structure may change without prior notice
4114 : : *
4115 : : * RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
4116 : : *
4117 : : * Modify a destination header field according to the specified
4118 : : * operation. Another field of the packet can be used as a source as well
4119 : : * as tag, mark, metadata, immediate value or a pointer to it.
4120 : : */
4121 : : struct rte_flow_action_modify_field {
4122 : : enum rte_flow_modify_op operation; /**< Operation to perform. */
4123 : : struct rte_flow_field_data dst; /**< Destination field. */
4124 : : struct rte_flow_field_data src; /**< Source field. */
4125 : : uint32_t width; /**< Number of bits to use from a source field. */
4126 : : };
4127 : :
4128 : : /**
4129 : : * RTE_FLOW_ACTION_TYPE_METER_MARK
4130 : : *
4131 : : * Traffic metering and marking (MTR).
4132 : : *
4133 : : * Meters a packet stream and marks its packets either
4134 : : * green, yellow, or red according to the specified profile.
4135 : : * The policy is optional and may be specified for defining
4136 : : * subsequent actions based on a color assigned by MTR.
4137 : : * Alternatively, the METER_COLOR item may be used for this.
4138 : : */
4139 : : struct rte_flow_action_meter_mark {
4140 : :
4141 : : /**< Profile config retrieved with rte_mtr_profile_get(). */
4142 : : struct rte_flow_meter_profile *profile;
4143 : : /**< Policy config retrieved with rte_mtr_policy_get(). */
4144 : : struct rte_flow_meter_policy *policy;
4145 : : /** Metering mode: 0 - Color-Blind, 1 - Color-Aware. */
4146 : : int color_mode;
4147 : : /** Metering state: 0 - Disabled, 1 - Enabled. */
4148 : : int state;
4149 : : };
4150 : :
4151 : : /**
4152 : : * RTE_FLOW_ACTION_TYPE_METER_MARK
4153 : : *
4154 : : * Wrapper structure for the context update interface.
4155 : : */
4156 : : struct rte_flow_update_meter_mark {
4157 : : /** New meter_mark parameters to be updated. */
4158 : : struct rte_flow_action_meter_mark meter_mark;
4159 : : /** The profile will be updated. */
4160 : : uint32_t profile_valid:1;
4161 : : /** The policy will be updated. */
4162 : : uint32_t policy_valid:1;
4163 : : /** The color mode will be updated. */
4164 : : uint32_t color_mode_valid:1;
4165 : : /** The meter state will be updated. */
4166 : : uint32_t state_valid:1;
4167 : : /** Reserved bits for the future usage. */
4168 : : uint32_t reserved:28;
4169 : : };
4170 : :
4171 : : /**
4172 : : * @see RTE_FLOW_ACTION_TYPE_METER_MARK
4173 : : * @see RTE_FLOW_ACTION_TYPE_INDIRECT_LIST
4174 : : *
4175 : : * Update flow mutable context.
4176 : : */
4177 : : struct rte_flow_indirect_update_flow_meter_mark {
4178 : : /** Updated init color applied to packet */
4179 : : enum rte_color init_color;
4180 : : };
4181 : :
4182 : : /**
4183 : : * @warning
4184 : : * @b EXPERIMENTAL: this structure may change without prior notice.
4185 : : *
4186 : : * Program action argument configuration parameters.
4187 : : *
4188 : : * For each action argument, its *size* must be non-zero and its *value* must
4189 : : * point to a valid array of *size* bytes specified in network byte order.
4190 : : *
4191 : : * @see struct rte_flow_action_prog
4192 : : */
4193 : : struct rte_flow_action_prog_argument {
4194 : : /** Argument name. */
4195 : : const char *name;
4196 : : /** Argument size in bytes. */
4197 : : uint32_t size;
4198 : : /** Argument value. */
4199 : : const uint8_t *value;
4200 : : };
4201 : :
4202 : : /**
4203 : : * @warning
4204 : : * @b EXPERIMENTAL: this structure may change without prior notice.
4205 : : *
4206 : : * RTE_FLOW_ACTION_TYPE_PROG
4207 : : *
4208 : : * Program action configuration parameters.
4209 : : *
4210 : : * Each action can have zero or more arguments. When *args_num* is non-zero, the
4211 : : * *args* parameter must point to a valid array of *args_num* elements.
4212 : : *
4213 : : * @see RTE_FLOW_ACTION_TYPE_PROG
4214 : : */
4215 : : struct rte_flow_action_prog {
4216 : : /** Action name. */
4217 : : const char *name;
4218 : : /** Number of action arguments. */
4219 : : uint32_t args_num;
4220 : : /** Action arguments array. */
4221 : : const struct rte_flow_action_prog_argument *args;
4222 : : };
4223 : :
4224 : : /* Mbuf dynamic field offset for metadata. */
4225 : : extern int32_t rte_flow_dynf_metadata_offs;
4226 : :
4227 : : /* Mbuf dynamic field flag mask for metadata. */
4228 : : extern uint64_t rte_flow_dynf_metadata_mask;
4229 : :
4230 : : /* Mbuf dynamic field pointer for metadata. */
4231 : : #define RTE_FLOW_DYNF_METADATA(m) \
4232 : : RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
4233 : :
4234 : : /* Mbuf dynamic flags for metadata. */
4235 : : #define RTE_MBUF_DYNFLAG_RX_METADATA (rte_flow_dynf_metadata_mask)
4236 : : #define RTE_MBUF_DYNFLAG_TX_METADATA (rte_flow_dynf_metadata_mask)
4237 : :
4238 : : __rte_experimental
4239 : : static inline uint32_t
4240 : : rte_flow_dynf_metadata_get(struct rte_mbuf *m)
4241 : : {
4242 : : return *RTE_FLOW_DYNF_METADATA(m);
4243 : : }
4244 : :
4245 : : __rte_experimental
4246 : : static inline void
4247 : : rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
4248 : : {
4249 : : *RTE_FLOW_DYNF_METADATA(m) = v;
4250 : : }
4251 : :
4252 : : /**
4253 : : * Definition of a single action.
4254 : : *
4255 : : * A list of actions is terminated by a END action.
4256 : : *
4257 : : * For simple actions without a configuration object, conf remains NULL.
4258 : : */
4259 : : struct rte_flow_action {
4260 : : enum rte_flow_action_type type; /**< Action type. */
4261 : : const void *conf; /**< Pointer to action configuration object. */
4262 : : };
4263 : :
4264 : : /**
4265 : : * Opaque type returned after successfully creating a flow.
4266 : : *
4267 : : * This handle can be used to manage and query the related flow (e.g. to
4268 : : * destroy it or retrieve counters).
4269 : : */
4270 : : struct rte_flow;
4271 : :
4272 : : /**
4273 : : * Opaque type for Meter profile object returned by MTR API.
4274 : : *
4275 : : * This handle can be used to create Meter actions instead of profile ID.
4276 : : */
4277 : : struct rte_flow_meter_profile;
4278 : :
4279 : : /**
4280 : : * Opaque type for Meter policy object returned by MTR API.
4281 : : *
4282 : : * This handle can be used to create Meter actions instead of policy ID.
4283 : : */
4284 : : struct rte_flow_meter_policy;
4285 : :
4286 : : /**
4287 : : * @warning
4288 : : * @b EXPERIMENTAL: this structure may change without prior notice
4289 : : *
4290 : : * RTE_FLOW_ACTION_TYPE_SAMPLE
4291 : : *
4292 : : * Adds a sample action to a matched flow.
4293 : : *
4294 : : * The matching packets will be duplicated with specified ratio and applied
4295 : : * with own set of actions with a fate action, the sampled packet could be
4296 : : * redirected to queue or port. All the packets continue processing on the
4297 : : * default flow path.
4298 : : *
4299 : : * When the sample ratio is set to 1 then the packets will be 100% mirrored.
4300 : : * Additional action list be supported to add for sampled or mirrored packets.
4301 : : */
4302 : : struct rte_flow_action_sample {
4303 : : uint32_t ratio; /**< packets sampled equals to '1/ratio'. */
4304 : : /** sub-action list specific for the sampling hit cases. */
4305 : : const struct rte_flow_action *actions;
4306 : : };
4307 : :
4308 : : /**
4309 : : * Verbose error types.
4310 : : *
4311 : : * Most of them provide the type of the object referenced by struct
4312 : : * rte_flow_error.cause.
4313 : : */
4314 : : enum rte_flow_error_type {
4315 : : RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
4316 : : RTE_FLOW_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
4317 : : RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
4318 : : RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
4319 : : RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
4320 : : RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< Ingress field. */
4321 : : RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< Egress field. */
4322 : : RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, /**< Transfer field. */
4323 : : RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure. */
4324 : : RTE_FLOW_ERROR_TYPE_ITEM_NUM, /**< Pattern length. */
4325 : : RTE_FLOW_ERROR_TYPE_ITEM_SPEC, /**< Item specification. */
4326 : : RTE_FLOW_ERROR_TYPE_ITEM_LAST, /**< Item specification range. */
4327 : : RTE_FLOW_ERROR_TYPE_ITEM_MASK, /**< Item specification mask. */
4328 : : RTE_FLOW_ERROR_TYPE_ITEM, /**< Specific pattern item. */
4329 : : RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
4330 : : RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */
4331 : : RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
4332 : : RTE_FLOW_ERROR_TYPE_STATE, /**< Current device state. */
4333 : : };
4334 : :
4335 : : /**
4336 : : * Verbose error structure definition.
4337 : : *
4338 : : * This object is normally allocated by applications and set by PMDs, the
4339 : : * message points to a constant string which does not need to be freed by
4340 : : * the application, however its pointer can be considered valid only as long
4341 : : * as its associated DPDK port remains configured. Closing the underlying
4342 : : * device or unloading the PMD invalidates it.
4343 : : *
4344 : : * Both cause and message may be NULL regardless of the error type.
4345 : : */
4346 : : struct rte_flow_error {
4347 : : enum rte_flow_error_type type; /**< Cause field and error types. */
4348 : : const void *cause; /**< Object responsible for the error. */
4349 : : const char *message; /**< Human-readable error message. */
4350 : : };
4351 : :
4352 : : /**
4353 : : * Complete flow rule description.
4354 : : *
4355 : : * This object type is used when converting a flow rule description.
4356 : : *
4357 : : * @see RTE_FLOW_CONV_OP_RULE
4358 : : * @see rte_flow_conv()
4359 : : */
4360 : : struct rte_flow_conv_rule {
4361 : : union {
4362 : : const struct rte_flow_attr *attr_ro; /**< RO attributes. */
4363 : : struct rte_flow_attr *attr; /**< Attributes. */
4364 : : };
4365 : : union {
4366 : : const struct rte_flow_item *pattern_ro; /**< RO pattern. */
4367 : : struct rte_flow_item *pattern; /**< Pattern items. */
4368 : : };
4369 : : union {
4370 : : const struct rte_flow_action *actions_ro; /**< RO actions. */
4371 : : struct rte_flow_action *actions; /**< List of actions. */
4372 : : };
4373 : : };
4374 : :
4375 : : /**
4376 : : * Conversion operations for flow API objects.
4377 : : *
4378 : : * @see rte_flow_conv()
4379 : : */
4380 : : enum rte_flow_conv_op {
4381 : : /**
4382 : : * No operation to perform.
4383 : : *
4384 : : * rte_flow_conv() simply returns 0.
4385 : : */
4386 : : RTE_FLOW_CONV_OP_NONE,
4387 : :
4388 : : /**
4389 : : * Convert attributes structure.
4390 : : *
4391 : : * This is a basic copy of an attributes structure.
4392 : : *
4393 : : * - @p src type:
4394 : : * @code const struct rte_flow_attr * @endcode
4395 : : * - @p dst type:
4396 : : * @code struct rte_flow_attr * @endcode
4397 : : */
4398 : : RTE_FLOW_CONV_OP_ATTR,
4399 : :
4400 : : /**
4401 : : * Convert a single item.
4402 : : *
4403 : : * Duplicates @p spec, @p last and @p mask but not outside objects.
4404 : : *
4405 : : * - @p src type:
4406 : : * @code const struct rte_flow_item * @endcode
4407 : : * - @p dst type:
4408 : : * @code struct rte_flow_item * @endcode
4409 : : */
4410 : : RTE_FLOW_CONV_OP_ITEM,
4411 : :
4412 : : /**
4413 : : * Convert a single action.
4414 : : *
4415 : : * Duplicates @p conf but not outside objects.
4416 : : *
4417 : : * - @p src type:
4418 : : * @code const struct rte_flow_action * @endcode
4419 : : * - @p dst type:
4420 : : * @code struct rte_flow_action * @endcode
4421 : : */
4422 : : RTE_FLOW_CONV_OP_ACTION,
4423 : :
4424 : : /**
4425 : : * Convert an entire pattern.
4426 : : *
4427 : : * Duplicates all pattern items at once with the same constraints as
4428 : : * RTE_FLOW_CONV_OP_ITEM.
4429 : : *
4430 : : * - @p src type:
4431 : : * @code const struct rte_flow_item * @endcode
4432 : : * - @p dst type:
4433 : : * @code struct rte_flow_item * @endcode
4434 : : */
4435 : : RTE_FLOW_CONV_OP_PATTERN,
4436 : :
4437 : : /**
4438 : : * Convert a list of actions.
4439 : : *
4440 : : * Duplicates the entire list of actions at once with the same
4441 : : * constraints as RTE_FLOW_CONV_OP_ACTION.
4442 : : *
4443 : : * - @p src type:
4444 : : * @code const struct rte_flow_action * @endcode
4445 : : * - @p dst type:
4446 : : * @code struct rte_flow_action * @endcode
4447 : : */
4448 : : RTE_FLOW_CONV_OP_ACTIONS,
4449 : :
4450 : : /**
4451 : : * Convert a complete flow rule description.
4452 : : *
4453 : : * Comprises attributes, pattern and actions together at once with
4454 : : * the usual constraints.
4455 : : *
4456 : : * - @p src type:
4457 : : * @code const struct rte_flow_conv_rule * @endcode
4458 : : * - @p dst type:
4459 : : * @code struct rte_flow_conv_rule * @endcode
4460 : : */
4461 : : RTE_FLOW_CONV_OP_RULE,
4462 : :
4463 : : /**
4464 : : * Convert item type to its name string.
4465 : : *
4466 : : * Writes a NUL-terminated string to @p dst. Like snprintf(), the
4467 : : * returned value excludes the terminator which is always written
4468 : : * nonetheless.
4469 : : *
4470 : : * - @p src type:
4471 : : * @code (const void *)enum rte_flow_item_type @endcode
4472 : : * - @p dst type:
4473 : : * @code char * @endcode
4474 : : */
4475 : : RTE_FLOW_CONV_OP_ITEM_NAME,
4476 : :
4477 : : /**
4478 : : * Convert action type to its name string.
4479 : : *
4480 : : * Writes a NUL-terminated string to @p dst. Like snprintf(), the
4481 : : * returned value excludes the terminator which is always written
4482 : : * nonetheless.
4483 : : *
4484 : : * - @p src type:
4485 : : * @code (const void *)enum rte_flow_action_type @endcode
4486 : : * - @p dst type:
4487 : : * @code char * @endcode
4488 : : */
4489 : : RTE_FLOW_CONV_OP_ACTION_NAME,
4490 : :
4491 : : /**
4492 : : * Convert item type to pointer to item name.
4493 : : *
4494 : : * Retrieves item name pointer from its type. The string itself is
4495 : : * not copied; instead, a unique pointer to an internal static
4496 : : * constant storage is written to @p dst.
4497 : : *
4498 : : * - @p src type:
4499 : : * @code (const void *)enum rte_flow_item_type @endcode
4500 : : * - @p dst type:
4501 : : * @code const char ** @endcode
4502 : : */
4503 : : RTE_FLOW_CONV_OP_ITEM_NAME_PTR,
4504 : :
4505 : : /**
4506 : : * Convert action type to pointer to action name.
4507 : : *
4508 : : * Retrieves action name pointer from its type. The string itself is
4509 : : * not copied; instead, a unique pointer to an internal static
4510 : : * constant storage is written to @p dst.
4511 : : *
4512 : : * - @p src type:
4513 : : * @code (const void *)enum rte_flow_action_type @endcode
4514 : : * - @p dst type:
4515 : : * @code const char ** @endcode
4516 : : */
4517 : : RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
4518 : : };
4519 : :
4520 : : /**
4521 : : * @warning
4522 : : * @b EXPERIMENTAL: this API may change without prior notice.
4523 : : *
4524 : : * Dump hardware internal representation information of
4525 : : * rte flow to file.
4526 : : *
4527 : : * @param[in] port_id
4528 : : * The port identifier of the Ethernet device.
4529 : : * @param[in] flow
4530 : : * The pointer of flow rule to dump. Dump all rules if NULL.
4531 : : * @param[in] file
4532 : : * A pointer to a file for output.
4533 : : * @param[out] error
4534 : : * Perform verbose error reporting if not NULL. PMDs initialize this
4535 : : * structure in case of error only.
4536 : : * @return
4537 : : * 0 on success, a negative value otherwise.
4538 : : */
4539 : : __rte_experimental
4540 : : int
4541 : : rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
4542 : : FILE *file, struct rte_flow_error *error);
4543 : :
4544 : : /**
4545 : : * Check if mbuf dynamic field for metadata is registered.
4546 : : *
4547 : : * @return
4548 : : * True if registered, false otherwise.
4549 : : */
4550 : : __rte_experimental
4551 : : static inline int
4552 : : rte_flow_dynf_metadata_avail(void)
4553 : : {
4554 [ # # ]: 0 : return !!rte_flow_dynf_metadata_mask;
4555 : : }
4556 : :
4557 : : /**
4558 : : * Register mbuf dynamic field and flag for metadata.
4559 : : *
4560 : : * This function must be called prior to use SET_META action in order to
4561 : : * register the dynamic mbuf field. Otherwise, the data cannot be delivered to
4562 : : * application.
4563 : : *
4564 : : * @return
4565 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
4566 : : */
4567 : : __rte_experimental
4568 : : int
4569 : : rte_flow_dynf_metadata_register(void);
4570 : :
4571 : : /**
4572 : : * Check whether a flow rule can be created on a given port.
4573 : : *
4574 : : * The flow rule is validated for correctness and whether it could be accepted
4575 : : * by the device given sufficient resources. The rule is checked against the
4576 : : * current device mode and queue configuration. The flow rule may also
4577 : : * optionally be validated against existing flow rules and device resources.
4578 : : * This function has no effect on the target device.
4579 : : *
4580 : : * The returned value is guaranteed to remain valid only as long as no
4581 : : * successful calls to rte_flow_create() or rte_flow_destroy() are made in
4582 : : * the meantime and no device parameter affecting flow rules in any way are
4583 : : * modified, due to possible collisions or resource limitations (although in
4584 : : * such cases EINVAL should not be returned).
4585 : : *
4586 : : * @param port_id
4587 : : * Port identifier of Ethernet device.
4588 : : * @param[in] attr
4589 : : * Flow rule attributes.
4590 : : * @param[in] pattern
4591 : : * Pattern specification (list terminated by the END pattern item).
4592 : : * @param[in] actions
4593 : : * Associated actions (list terminated by the END action).
4594 : : * @param[out] error
4595 : : * Perform verbose error reporting if not NULL. PMDs initialize this
4596 : : * structure in case of error only.
4597 : : *
4598 : : * @return
4599 : : * 0 if flow rule is valid and can be created. A negative errno value
4600 : : * otherwise (rte_errno is also set), the following errors are defined:
4601 : : *
4602 : : * -ENOSYS: underlying device does not support this functionality.
4603 : : *
4604 : : * -EIO: underlying device is removed.
4605 : : *
4606 : : * -EINVAL: unknown or invalid rule specification.
4607 : : *
4608 : : * -ENOTSUP: valid but unsupported rule specification (e.g. partial
4609 : : * bit-masks are unsupported).
4610 : : *
4611 : : * -EEXIST: collision with an existing rule. Only returned if device
4612 : : * supports flow rule collision checking and there was a flow rule
4613 : : * collision. Not receiving this return code is no guarantee that creating
4614 : : * the rule will not fail due to a collision.
4615 : : *
4616 : : * -ENOMEM: not enough memory to execute the function, or if the device
4617 : : * supports resource validation, resource limitation on the device.
4618 : : *
4619 : : * -EBUSY: action cannot be performed due to busy device resources, may
4620 : : * succeed if the affected queues or even the entire port are in a stopped
4621 : : * state (see rte_eth_dev_rx_queue_stop() and rte_eth_dev_stop()).
4622 : : */
4623 : : int
4624 : : rte_flow_validate(uint16_t port_id,
4625 : : const struct rte_flow_attr *attr,
4626 : : const struct rte_flow_item pattern[],
4627 : : const struct rte_flow_action actions[],
4628 : : struct rte_flow_error *error);
4629 : :
4630 : : /**
4631 : : * Create a flow rule on a given port.
4632 : : *
4633 : : * @param port_id
4634 : : * Port identifier of Ethernet device.
4635 : : * @param[in] attr
4636 : : * Flow rule attributes.
4637 : : * @param[in] pattern
4638 : : * Pattern specification (list terminated by the END pattern item).
4639 : : * @param[in] actions
4640 : : * Associated actions (list terminated by the END action).
4641 : : * @param[out] error
4642 : : * Perform verbose error reporting if not NULL. PMDs initialize this
4643 : : * structure in case of error only.
4644 : : *
4645 : : * @return
4646 : : * A valid handle in case of success, NULL otherwise and rte_errno is set
4647 : : * to the positive version of one of the error codes defined for
4648 : : * rte_flow_validate().
4649 : : */
4650 : : struct rte_flow *
4651 : : rte_flow_create(uint16_t port_id,
4652 : : const struct rte_flow_attr *attr,
4653 : : const struct rte_flow_item pattern[],
4654 : : const struct rte_flow_action actions[],
4655 : : struct rte_flow_error *error);
4656 : :
4657 : : /**
4658 : : * Destroy a flow rule on a given port.
4659 : : *
4660 : : * Failure to destroy a flow rule handle may occur when other flow rules
4661 : : * depend on it, and destroying it would result in an inconsistent state.
4662 : : *
4663 : : * This function is only guaranteed to succeed if handles are destroyed in
4664 : : * reverse order of their creation.
4665 : : *
4666 : : * @param port_id
4667 : : * Port identifier of Ethernet device.
4668 : : * @param flow
4669 : : * Flow rule handle to destroy.
4670 : : * @param[out] error
4671 : : * Perform verbose error reporting if not NULL. PMDs initialize this
4672 : : * structure in case of error only.
4673 : : *
4674 : : * @return
4675 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
4676 : : */
4677 : : int
4678 : : rte_flow_destroy(uint16_t port_id,
4679 : : struct rte_flow *flow,
4680 : : struct rte_flow_error *error);
4681 : :
4682 : : /**
4683 : : * Update a flow rule with new actions on a given port.
4684 : : *
4685 : : * @param port_id
4686 : : * Port identifier of Ethernet device.
4687 : : * @param flow
4688 : : * Flow rule handle to update.
4689 : : * @param[in] actions
4690 : : * Associated actions (list terminated by the END action).
4691 : : * @param[out] error
4692 : : * Perform verbose error reporting if not NULL. PMDs initialize this
4693 : : * structure in case of error only.
4694 : : *
4695 : : * @return
4696 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
4697 : : */
4698 : : __rte_experimental
4699 : : int
4700 : : rte_flow_actions_update(uint16_t port_id,
4701 : : struct rte_flow *flow,
4702 : : const struct rte_flow_action actions[],
4703 : : struct rte_flow_error *error);
4704 : :
4705 : : /**
4706 : : * Destroy all flow rules associated with a port.
4707 : : *
4708 : : * In the unlikely event of failure, handles are still considered destroyed
4709 : : * and no longer valid but the port must be assumed to be in an inconsistent
4710 : : * state.
4711 : : *
4712 : : * @param port_id
4713 : : * Port identifier of Ethernet device.
4714 : : * @param[out] error
4715 : : * Perform verbose error reporting if not NULL. PMDs initialize this
4716 : : * structure in case of error only.
4717 : : *
4718 : : * @return
4719 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
4720 : : */
4721 : : int
4722 : : rte_flow_flush(uint16_t port_id,
4723 : : struct rte_flow_error *error);
4724 : :
4725 : : /**
4726 : : * Query an existing flow rule.
4727 : : *
4728 : : * This function allows retrieving flow-specific data such as counters.
4729 : : * Data is gathered by special actions which must be present in the flow
4730 : : * rule definition.
4731 : : *
4732 : : * \see RTE_FLOW_ACTION_TYPE_COUNT
4733 : : *
4734 : : * @param port_id
4735 : : * Port identifier of Ethernet device.
4736 : : * @param flow
4737 : : * Flow rule handle to query.
4738 : : * @param action
4739 : : * Action definition as defined in original flow rule.
4740 : : * @param[in, out] data
4741 : : * Pointer to storage for the associated query data type.
4742 : : * @param[out] error
4743 : : * Perform verbose error reporting if not NULL. PMDs initialize this
4744 : : * structure in case of error only.
4745 : : *
4746 : : * @return
4747 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
4748 : : */
4749 : : int
4750 : : rte_flow_query(uint16_t port_id,
4751 : : struct rte_flow *flow,
4752 : : const struct rte_flow_action *action,
4753 : : void *data,
4754 : : struct rte_flow_error *error);
4755 : :
4756 : : /**
4757 : : * Restrict ingress traffic to the defined flow rules.
4758 : : *
4759 : : * Isolated mode guarantees that all ingress traffic comes from defined flow
4760 : : * rules only (current and future).
4761 : : * When enabled with a bifurcated driver,
4762 : : * non-matched packets are routed to the kernel driver interface.
4763 : : * When disabled (the default),
4764 : : * there may be some default rules routing traffic to the DPDK port.
4765 : : *
4766 : : * Besides making ingress more deterministic, it allows PMDs to safely reuse
4767 : : * resources otherwise assigned to handle the remaining traffic, such as
4768 : : * global RSS configuration settings, VLAN filters, MAC address entries,
4769 : : * legacy filter API rules and so on in order to expand the set of possible
4770 : : * flow rule types.
4771 : : *
4772 : : * Calling this function as soon as possible after device initialization,
4773 : : * ideally before the first call to rte_eth_dev_configure(), is recommended
4774 : : * to avoid possible failures due to conflicting settings.
4775 : : *
4776 : : * Once effective, leaving isolated mode may not be possible depending on
4777 : : * PMD implementation.
4778 : : *
4779 : : * Additionally, the following functionality has no effect on the underlying
4780 : : * port and may return errors such as ENOTSUP ("not supported"):
4781 : : *
4782 : : * - Toggling promiscuous mode.
4783 : : * - Toggling allmulticast mode.
4784 : : * - Configuring MAC addresses.
4785 : : * - Configuring multicast addresses.
4786 : : * - Configuring VLAN filters.
4787 : : * - Configuring Rx filters through the legacy API (e.g. FDIR).
4788 : : * - Configuring global RSS settings.
4789 : : *
4790 : : * @param port_id
4791 : : * Port identifier of Ethernet device.
4792 : : * @param set
4793 : : * Nonzero to enter isolated mode, attempt to leave it otherwise.
4794 : : * @param[out] error
4795 : : * Perform verbose error reporting if not NULL. PMDs initialize this
4796 : : * structure in case of error only.
4797 : : *
4798 : : * @return
4799 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
4800 : : */
4801 : : int
4802 : : rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
4803 : :
4804 : : /**
4805 : : * Initialize flow error structure.
4806 : : *
4807 : : * @param[out] error
4808 : : * Pointer to flow error structure (may be NULL).
4809 : : * @param code
4810 : : * Related error code (rte_errno).
4811 : : * @param type
4812 : : * Cause field and error types.
4813 : : * @param cause
4814 : : * Object responsible for the error.
4815 : : * @param message
4816 : : * Human-readable error message.
4817 : : *
4818 : : * @return
4819 : : * Negative error code (errno value) and rte_errno is set.
4820 : : */
4821 : : int
4822 : : rte_flow_error_set(struct rte_flow_error *error,
4823 : : int code,
4824 : : enum rte_flow_error_type type,
4825 : : const void *cause,
4826 : : const char *message);
4827 : :
4828 : : /**
4829 : : * @deprecated
4830 : : * @see rte_flow_copy()
4831 : : */
4832 : : struct rte_flow_desc {
4833 : : size_t size; /**< Allocated space including data[]. */
4834 : : struct rte_flow_attr attr; /**< Attributes. */
4835 : : struct rte_flow_item *items; /**< Items. */
4836 : : struct rte_flow_action *actions; /**< Actions. */
4837 : : uint8_t data[]; /**< Storage for items/actions. */
4838 : : };
4839 : :
4840 : : /**
4841 : : * @deprecated
4842 : : * Copy an rte_flow rule description.
4843 : : *
4844 : : * This interface is kept for compatibility with older applications but is
4845 : : * implemented as a wrapper to rte_flow_conv(). It is deprecated due to its
4846 : : * lack of flexibility and reliance on a type unusable with C++ programs
4847 : : * (struct rte_flow_desc).
4848 : : *
4849 : : * @param[in] fd
4850 : : * Flow rule description.
4851 : : * @param[in] len
4852 : : * Total size of allocated data for the flow description.
4853 : : * @param[in] attr
4854 : : * Flow rule attributes.
4855 : : * @param[in] items
4856 : : * Pattern specification (list terminated by the END pattern item).
4857 : : * @param[in] actions
4858 : : * Associated actions (list terminated by the END action).
4859 : : *
4860 : : * @return
4861 : : * If len is greater or equal to the size of the flow, the total size of the
4862 : : * flow description and its data.
4863 : : * If len is lower than the size of the flow, the number of bytes that would
4864 : : * have been written to desc had it been sufficient. Nothing is written.
4865 : : */
4866 : : __rte_deprecated
4867 : : size_t
4868 : : rte_flow_copy(struct rte_flow_desc *fd, size_t len,
4869 : : const struct rte_flow_attr *attr,
4870 : : const struct rte_flow_item *items,
4871 : : const struct rte_flow_action *actions);
4872 : :
4873 : : /**
4874 : : * Flow object conversion helper.
4875 : : *
4876 : : * This function performs conversion of various flow API objects to a
4877 : : * pre-allocated destination buffer. See enum rte_flow_conv_op for possible
4878 : : * operations and details about each of them.
4879 : : *
4880 : : * Since destination buffer must be large enough, it works in a manner
4881 : : * reminiscent of snprintf():
4882 : : *
4883 : : * - If @p size is 0, @p dst may be a NULL pointer, otherwise @p dst must be
4884 : : * non-NULL.
4885 : : * - If positive, the returned value represents the number of bytes needed
4886 : : * to store the conversion of @p src to @p dst according to @p op
4887 : : * regardless of the @p size parameter.
4888 : : * - Since no more than @p size bytes can be written to @p dst, output is
4889 : : * truncated and may be inconsistent when the returned value is larger
4890 : : * than that.
4891 : : * - In case of conversion error, a negative error code is returned and
4892 : : * @p dst contents are unspecified.
4893 : : *
4894 : : * @param op
4895 : : * Operation to perform, related to the object type of @p dst.
4896 : : * @param[out] dst
4897 : : * Destination buffer address. Must be suitably aligned by the caller.
4898 : : * @param size
4899 : : * Destination buffer size in bytes.
4900 : : * @param[in] src
4901 : : * Source object to copy. Depending on @p op, its type may differ from
4902 : : * that of @p dst.
4903 : : * @param[out] error
4904 : : * Perform verbose error reporting if not NULL. Initialized in case of
4905 : : * error only.
4906 : : *
4907 : : * @return
4908 : : * The number of bytes required to convert @p src to @p dst on success, a
4909 : : * negative errno value otherwise and rte_errno is set.
4910 : : *
4911 : : * @see rte_flow_conv_op
4912 : : */
4913 : : __rte_experimental
4914 : : int
4915 : : rte_flow_conv(enum rte_flow_conv_op op,
4916 : : void *dst,
4917 : : size_t size,
4918 : : const void *src,
4919 : : struct rte_flow_error *error);
4920 : :
4921 : : /**
4922 : : * Get aged-out flows of a given port.
4923 : : *
4924 : : * RTE_ETH_EVENT_FLOW_AGED event will be triggered when at least one new aged
4925 : : * out flow was detected after the last call to rte_flow_get_aged_flows.
4926 : : * This function can be called to get the aged flows asynchronously from the
4927 : : * event callback or synchronously regardless the event.
4928 : : * This is not safe to call rte_flow_get_aged_flows function with other flow
4929 : : * functions from multiple threads simultaneously.
4930 : : *
4931 : : * @param port_id
4932 : : * Port identifier of Ethernet device.
4933 : : * @param[in, out] contexts
4934 : : * The address of an array of pointers to the aged-out flows contexts.
4935 : : * @param[in] nb_contexts
4936 : : * The length of context array pointers.
4937 : : * @param[out] error
4938 : : * Perform verbose error reporting if not NULL. Initialized in case of
4939 : : * error only.
4940 : : *
4941 : : * @return
4942 : : * if nb_contexts is 0, return the amount of all aged contexts.
4943 : : * if nb_contexts is not 0 , return the amount of aged flows reported
4944 : : * in the context array, otherwise negative errno value.
4945 : : *
4946 : : * @see rte_flow_action_age
4947 : : * @see RTE_ETH_EVENT_FLOW_AGED
4948 : : */
4949 : : __rte_experimental
4950 : : int
4951 : : rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
4952 : : uint32_t nb_contexts, struct rte_flow_error *error);
4953 : :
4954 : : /**
4955 : : * @warning
4956 : : * @b EXPERIMENTAL: this API may change without prior notice.
4957 : : *
4958 : : * Get aged-out flows of a given port on the given flow queue.
4959 : : *
4960 : : * If application configure port attribute with RTE_FLOW_PORT_FLAG_STRICT_QUEUE,
4961 : : * there is no RTE_ETH_EVENT_FLOW_AGED event and this function must be called to
4962 : : * get the aged flows synchronously.
4963 : : *
4964 : : * If application configure port attribute without
4965 : : * RTE_FLOW_PORT_FLAG_STRICT_QUEUE, RTE_ETH_EVENT_FLOW_AGED event will be
4966 : : * triggered at least one new aged out flow was detected on any flow queue after
4967 : : * the last call to rte_flow_get_q_aged_flows.
4968 : : * In addition, the @p queue_id will be ignored.
4969 : : * This function can be called to get the aged flows asynchronously from the
4970 : : * event callback or synchronously regardless the event.
4971 : : *
4972 : : * @param[in] port_id
4973 : : * Port identifier of Ethernet device.
4974 : : * @param[in] queue_id
4975 : : * Flow queue to query. Ignored when RTE_FLOW_PORT_FLAG_STRICT_QUEUE not set.
4976 : : * @param[in, out] contexts
4977 : : * The address of an array of pointers to the aged-out flows contexts.
4978 : : * @param[in] nb_contexts
4979 : : * The length of context array pointers.
4980 : : * @param[out] error
4981 : : * Perform verbose error reporting if not NULL. Initialized in case of
4982 : : * error only.
4983 : : *
4984 : : * @return
4985 : : * if nb_contexts is 0, return the amount of all aged contexts.
4986 : : * if nb_contexts is not 0 , return the amount of aged flows reported
4987 : : * in the context array, otherwise negative errno value.
4988 : : *
4989 : : * @see rte_flow_action_age
4990 : : * @see RTE_ETH_EVENT_FLOW_AGED
4991 : : * @see rte_flow_port_flag
4992 : : */
4993 : : __rte_experimental
4994 : : int
4995 : : rte_flow_get_q_aged_flows(uint16_t port_id, uint32_t queue_id, void **contexts,
4996 : : uint32_t nb_contexts, struct rte_flow_error *error);
4997 : :
4998 : : /**
4999 : : * Specify indirect action object configuration
5000 : : */
5001 : : struct rte_flow_indir_action_conf {
5002 : : /**
5003 : : * Flow direction for the indirect action configuration.
5004 : : *
5005 : : * Action should be valid at least for one flow direction,
5006 : : * otherwise it is invalid for both ingress and egress rules.
5007 : : */
5008 : : /** Action valid for rules applied to ingress traffic. */
5009 : : uint32_t ingress:1;
5010 : : /** Action valid for rules applied to egress traffic. */
5011 : : uint32_t egress:1;
5012 : : /**
5013 : : * When set to 1, indicates that the action is valid for
5014 : : * transfer traffic; otherwise, for non-transfer traffic.
5015 : : */
5016 : : uint32_t transfer:1;
5017 : : };
5018 : :
5019 : : /**
5020 : : * @warning
5021 : : * @b EXPERIMENTAL: this API may change without prior notice.
5022 : : *
5023 : : * Create an indirect action object that can be used in flow rules
5024 : : * via its handle.
5025 : : * The created object handle has single state and configuration
5026 : : * across all the flow rules using it.
5027 : : *
5028 : : * @param[in] port_id
5029 : : * The port identifier of the Ethernet device.
5030 : : * @param[in] conf
5031 : : * Action configuration for the indirect action object creation.
5032 : : * @param[in] action
5033 : : * Specific configuration of the indirect action object.
5034 : : * @param[out] error
5035 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5036 : : * structure in case of error only.
5037 : : * @return
5038 : : * A valid handle in case of success, NULL otherwise and rte_errno is set
5039 : : * to one of the error codes defined:
5040 : : * - (ENODEV) if *port_id* invalid.
5041 : : * - (ENOSYS) if underlying device does not support this functionality.
5042 : : * - (EIO) if underlying device is removed.
5043 : : * - (EINVAL) if *action* invalid.
5044 : : * - (ENOTSUP) if *action* valid but unsupported.
5045 : : */
5046 : : __rte_experimental
5047 : : struct rte_flow_action_handle *
5048 : : rte_flow_action_handle_create(uint16_t port_id,
5049 : : const struct rte_flow_indir_action_conf *conf,
5050 : : const struct rte_flow_action *action,
5051 : : struct rte_flow_error *error);
5052 : :
5053 : : /**
5054 : : * @warning
5055 : : * @b EXPERIMENTAL: this API may change without prior notice.
5056 : : *
5057 : : * Destroy indirect action by handle.
5058 : : *
5059 : : * @param[in] port_id
5060 : : * The port identifier of the Ethernet device.
5061 : : * @param[in] handle
5062 : : * Handle for the indirect action object to be destroyed.
5063 : : * @param[out] error
5064 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5065 : : * structure in case of error only.
5066 : : * @return
5067 : : * - (0) if success.
5068 : : * - (-ENODEV) if *port_id* invalid.
5069 : : * - (-ENOSYS) if underlying device does not support this functionality.
5070 : : * - (-EIO) if underlying device is removed.
5071 : : * - (-ENOENT) if action pointed by *action* handle was not found.
5072 : : * - (-EBUSY) if action pointed by *action* handle still used by some rules
5073 : : * rte_errno is also set.
5074 : : */
5075 : : __rte_experimental
5076 : : int
5077 : : rte_flow_action_handle_destroy(uint16_t port_id,
5078 : : struct rte_flow_action_handle *handle,
5079 : : struct rte_flow_error *error);
5080 : :
5081 : : /**
5082 : : * @warning
5083 : : * @b EXPERIMENTAL: this API may change without prior notice.
5084 : : *
5085 : : * Update in-place the action configuration and / or state pointed
5086 : : * by action *handle* with the configuration provided as *update* argument.
5087 : : * The update of the action configuration effects all flow rules reusing
5088 : : * the action via *handle*.
5089 : : * The update general pointer provides the ability of partial updating.
5090 : : *
5091 : : * @param[in] port_id
5092 : : * The port identifier of the Ethernet device.
5093 : : * @param[in] handle
5094 : : * Handle for the indirect action object to be updated.
5095 : : * @param[in] update
5096 : : * Update profile specification used to modify the action pointed by handle.
5097 : : * *update* could be with the same type of the immediate action corresponding
5098 : : * to the *handle* argument when creating, or a wrapper structure includes
5099 : : * action configuration to be updated and bit fields to indicate the member
5100 : : * of fields inside the action to update.
5101 : : * @param[out] error
5102 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5103 : : * structure in case of error only.
5104 : : * @return
5105 : : * - (0) if success.
5106 : : * - (-ENODEV) if *port_id* invalid.
5107 : : * - (-ENOSYS) if underlying device does not support this functionality.
5108 : : * - (-EIO) if underlying device is removed.
5109 : : * - (-EINVAL) if *update* invalid.
5110 : : * - (-ENOTSUP) if *update* valid but unsupported.
5111 : : * - (-ENOENT) if indirect action object pointed by *handle* was not found.
5112 : : * rte_errno is also set.
5113 : : */
5114 : : __rte_experimental
5115 : : int
5116 : : rte_flow_action_handle_update(uint16_t port_id,
5117 : : struct rte_flow_action_handle *handle,
5118 : : const void *update,
5119 : : struct rte_flow_error *error);
5120 : :
5121 : : /**
5122 : : * @warning
5123 : : * @b EXPERIMENTAL: this API may change without prior notice.
5124 : : *
5125 : : * Query the direct action by corresponding indirect action object handle.
5126 : : *
5127 : : * Retrieve action-specific data such as counters.
5128 : : * Data is gathered by special action which may be present/referenced in
5129 : : * more than one flow rule definition.
5130 : : *
5131 : : * @see RTE_FLOW_ACTION_TYPE_COUNT
5132 : : *
5133 : : * @param port_id
5134 : : * Port identifier of Ethernet device.
5135 : : * @param[in] handle
5136 : : * Handle for the action object to query.
5137 : : * @param[in, out] data
5138 : : * Pointer to storage for the associated query data type.
5139 : : * @param[out] error
5140 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5141 : : * structure in case of error only.
5142 : : *
5143 : : * @return
5144 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5145 : : */
5146 : : __rte_experimental
5147 : : int
5148 : : rte_flow_action_handle_query(uint16_t port_id,
5149 : : const struct rte_flow_action_handle *handle,
5150 : : void *data, struct rte_flow_error *error);
5151 : :
5152 : : /* Tunnel has a type and the key information. */
5153 : : struct rte_flow_tunnel {
5154 : : /**
5155 : : * Tunnel type, for example RTE_FLOW_ITEM_TYPE_VXLAN,
5156 : : * RTE_FLOW_ITEM_TYPE_NVGRE etc.
5157 : : */
5158 : : enum rte_flow_item_type type;
5159 : : uint64_t tun_id; /**< Tunnel identification. */
5160 : :
5161 : : union {
5162 : : struct {
5163 : : rte_be32_t src_addr; /**< IPv4 source address. */
5164 : : rte_be32_t dst_addr; /**< IPv4 destination address. */
5165 : : } ipv4;
5166 : : struct {
5167 : : uint8_t src_addr[16]; /**< IPv6 source address. */
5168 : : uint8_t dst_addr[16]; /**< IPv6 destination address. */
5169 : : } ipv6;
5170 : : };
5171 : : rte_be16_t tp_src; /**< Tunnel port source. */
5172 : : rte_be16_t tp_dst; /**< Tunnel port destination. */
5173 : : uint16_t tun_flags; /**< Tunnel flags. */
5174 : :
5175 : : bool is_ipv6; /**< True for valid IPv6 fields. Otherwise IPv4. */
5176 : :
5177 : : /**
5178 : : * the following members are required to restore packet
5179 : : * after miss
5180 : : */
5181 : : uint8_t tos; /**< TOS for IPv4, TC for IPv6. */
5182 : : uint8_t ttl; /**< TTL for IPv4, HL for IPv6. */
5183 : : uint32_t label; /**< Flow Label for IPv6. */
5184 : : };
5185 : :
5186 : : /**
5187 : : * Indicate that the packet has a tunnel.
5188 : : */
5189 : : #define RTE_FLOW_RESTORE_INFO_TUNNEL RTE_BIT64(0)
5190 : :
5191 : : /**
5192 : : * Indicate that the packet has a non decapsulated tunnel header.
5193 : : */
5194 : : #define RTE_FLOW_RESTORE_INFO_ENCAPSULATED RTE_BIT64(1)
5195 : :
5196 : : /**
5197 : : * Indicate that the packet has a group_id.
5198 : : */
5199 : : #define RTE_FLOW_RESTORE_INFO_GROUP_ID RTE_BIT64(2)
5200 : :
5201 : : /**
5202 : : * Restore information structure to communicate the current packet processing
5203 : : * state when some of the processing pipeline is done in hardware and should
5204 : : * continue in software.
5205 : : */
5206 : : struct rte_flow_restore_info {
5207 : : /**
5208 : : * Bitwise flags (RTE_FLOW_RESTORE_INFO_*) to indicate validation of
5209 : : * other fields in struct rte_flow_restore_info.
5210 : : */
5211 : : uint64_t flags;
5212 : : uint32_t group_id; /**< Group ID where packed missed */
5213 : : struct rte_flow_tunnel tunnel; /**< Tunnel information. */
5214 : : };
5215 : :
5216 : : /**
5217 : : * Allocate an array of actions to be used in rte_flow_create, to implement
5218 : : * tunnel-decap-set for the given tunnel.
5219 : : * Sample usage:
5220 : : * actions vxlan_decap / tunnel-decap-set(tunnel properties) /
5221 : : * jump group 0 / end
5222 : : *
5223 : : * @param port_id
5224 : : * Port identifier of Ethernet device.
5225 : : * @param[in] tunnel
5226 : : * Tunnel properties.
5227 : : * @param[out] actions
5228 : : * Array of actions to be allocated by the PMD. This array should be
5229 : : * concatenated with the actions array provided to rte_flow_create.
5230 : : * @param[out] num_of_actions
5231 : : * Number of actions allocated.
5232 : : * @param[out] error
5233 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5234 : : * structure in case of error only.
5235 : : *
5236 : : * @return
5237 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5238 : : */
5239 : : __rte_experimental
5240 : : int
5241 : : rte_flow_tunnel_decap_set(uint16_t port_id,
5242 : : struct rte_flow_tunnel *tunnel,
5243 : : struct rte_flow_action **actions,
5244 : : uint32_t *num_of_actions,
5245 : : struct rte_flow_error *error);
5246 : :
5247 : : /**
5248 : : * Allocate an array of items to be used in rte_flow_create, to implement
5249 : : * tunnel-match for the given tunnel.
5250 : : * Sample usage:
5251 : : * pattern tunnel-match(tunnel properties) / outer-header-matches /
5252 : : * inner-header-matches / end
5253 : : *
5254 : : * @param port_id
5255 : : * Port identifier of Ethernet device.
5256 : : * @param[in] tunnel
5257 : : * Tunnel properties.
5258 : : * @param[out] items
5259 : : * Array of items to be allocated by the PMD. This array should be
5260 : : * concatenated with the items array provided to rte_flow_create.
5261 : : * @param[out] num_of_items
5262 : : * Number of items allocated.
5263 : : * @param[out] error
5264 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5265 : : * structure in case of error only.
5266 : : *
5267 : : * @return
5268 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5269 : : */
5270 : : __rte_experimental
5271 : : int
5272 : : rte_flow_tunnel_match(uint16_t port_id,
5273 : : struct rte_flow_tunnel *tunnel,
5274 : : struct rte_flow_item **items,
5275 : : uint32_t *num_of_items,
5276 : : struct rte_flow_error *error);
5277 : :
5278 : : /**
5279 : : * On reception of a mbuf from HW, a call to rte_flow_get_restore_info() may be
5280 : : * required to retrieve some metadata.
5281 : : * This function returns the associated mbuf ol_flags.
5282 : : *
5283 : : * Note: the dynamic flag is registered during a call to
5284 : : * rte_eth_rx_metadata_negotiate() with RTE_ETH_RX_METADATA_TUNNEL_ID.
5285 : : *
5286 : : * @return
5287 : : * The offload flag indicating rte_flow_get_restore_info() must be called.
5288 : : */
5289 : : __rte_experimental
5290 : : uint64_t
5291 : : rte_flow_restore_info_dynflag(void);
5292 : :
5293 : : /**
5294 : : * If a mbuf contains the rte_flow_restore_info_dynflag() flag in ol_flags,
5295 : : * populate the current packet processing state.
5296 : : *
5297 : : * One should negotiate tunnel metadata delivery from the NIC to the HW.
5298 : : * @see rte_eth_rx_metadata_negotiate()
5299 : : * @see RTE_ETH_RX_METADATA_TUNNEL_ID
5300 : : *
5301 : : * @param port_id
5302 : : * Port identifier of Ethernet device.
5303 : : * @param[in] m
5304 : : * Mbuf struct.
5305 : : * @param[out] info
5306 : : * Restore information. Upon success contains the HW state.
5307 : : * @param[out] error
5308 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5309 : : * structure in case of error only.
5310 : : *
5311 : : * @return
5312 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5313 : : */
5314 : : __rte_experimental
5315 : : int
5316 : : rte_flow_get_restore_info(uint16_t port_id,
5317 : : struct rte_mbuf *m,
5318 : : struct rte_flow_restore_info *info,
5319 : : struct rte_flow_error *error);
5320 : :
5321 : : /**
5322 : : * Release the action array as allocated by rte_flow_tunnel_decap_set.
5323 : : *
5324 : : * @param port_id
5325 : : * Port identifier of Ethernet device.
5326 : : * @param[in] actions
5327 : : * Array of actions to be released.
5328 : : * @param[in] num_of_actions
5329 : : * Number of elements in actions array.
5330 : : * @param[out] error
5331 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5332 : : * structure in case of error only.
5333 : : *
5334 : : * @return
5335 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5336 : : */
5337 : : __rte_experimental
5338 : : int
5339 : : rte_flow_tunnel_action_decap_release(uint16_t port_id,
5340 : : struct rte_flow_action *actions,
5341 : : uint32_t num_of_actions,
5342 : : struct rte_flow_error *error);
5343 : :
5344 : : /**
5345 : : * Release the item array as allocated by rte_flow_tunnel_match.
5346 : : *
5347 : : * @param port_id
5348 : : * Port identifier of Ethernet device.
5349 : : * @param[in] items
5350 : : * Array of items to be released.
5351 : : * @param[in] num_of_items
5352 : : * Number of elements in item array.
5353 : : * @param[out] error
5354 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5355 : : * structure in case of error only.
5356 : : *
5357 : : * @return
5358 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5359 : : */
5360 : : __rte_experimental
5361 : : int
5362 : : rte_flow_tunnel_item_release(uint16_t port_id,
5363 : : struct rte_flow_item *items,
5364 : : uint32_t num_of_items,
5365 : : struct rte_flow_error *error);
5366 : :
5367 : : /**
5368 : : * Get a proxy port to manage "transfer" flows.
5369 : : *
5370 : : * Managing "transfer" flows requires that the user communicate them
5371 : : * via a port which has the privilege to control the embedded switch.
5372 : : * For some vendors, all ports in a given switching domain have
5373 : : * this privilege. For other vendors, it's only one port.
5374 : : *
5375 : : * This API indicates such a privileged port (a "proxy")
5376 : : * for a given port in the same switching domain.
5377 : : *
5378 : : * @note
5379 : : * If the PMD serving @p port_id doesn't have the corresponding method
5380 : : * implemented, the API will return @p port_id via @p proxy_port_id.
5381 : : *
5382 : : * @param port_id
5383 : : * Indicates the port to get a "proxy" for
5384 : : * @param[out] proxy_port_id
5385 : : * Indicates the "proxy" port
5386 : : * @param[out] error
5387 : : * If not NULL, allows the PMD to provide verbose report in case of error
5388 : : *
5389 : : * @return
5390 : : * 0 on success, a negative error code otherwise
5391 : : */
5392 : : int
5393 : : rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id,
5394 : : struct rte_flow_error *error);
5395 : :
5396 : : /**
5397 : : * @warning
5398 : : * @b EXPERIMENTAL: this API may change without prior notice.
5399 : : *
5400 : : * Create the flex item with specified configuration over
5401 : : * the Ethernet device.
5402 : : *
5403 : : * @param port_id
5404 : : * Port identifier of Ethernet device.
5405 : : * @param[in] conf
5406 : : * Item configuration.
5407 : : * @param[out] error
5408 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5409 : : * structure in case of error only.
5410 : : *
5411 : : * @return
5412 : : * Non-NULL opaque pointer on success, NULL otherwise and rte_errno is set.
5413 : : */
5414 : : __rte_experimental
5415 : : struct rte_flow_item_flex_handle *
5416 : : rte_flow_flex_item_create(uint16_t port_id,
5417 : : const struct rte_flow_item_flex_conf *conf,
5418 : : struct rte_flow_error *error);
5419 : :
5420 : : /**
5421 : : * Release the flex item on the specified Ethernet device.
5422 : : *
5423 : : * @param port_id
5424 : : * Port identifier of Ethernet device.
5425 : : * @param[in] handle
5426 : : * Handle of the item existing on the specified device.
5427 : : * @param[out] error
5428 : : * Perform verbose error reporting if not NULL. PMDs initialize this
5429 : : * structure in case of error only.
5430 : : *
5431 : : * @return
5432 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5433 : : */
5434 : : __rte_experimental
5435 : : int
5436 : : rte_flow_flex_item_release(uint16_t port_id,
5437 : : const struct rte_flow_item_flex_handle *handle,
5438 : : struct rte_flow_error *error);
5439 : :
5440 : : /**
5441 : : * Indicate all operations for a given flow rule will _strictly_
5442 : : * happen on the same queue (create/destroy/query/update).
5443 : : */
5444 : : #define RTE_FLOW_PORT_FLAG_STRICT_QUEUE RTE_BIT32(0)
5445 : :
5446 : : /**
5447 : : * Indicate all steering objects should be created on contexts
5448 : : * of the host port, providing indirect object sharing between
5449 : : * ports.
5450 : : */
5451 : : #define RTE_FLOW_PORT_FLAG_SHARE_INDIRECT RTE_BIT32(1)
5452 : :
5453 : : /**
5454 : : * @warning
5455 : : * @b EXPERIMENTAL: this API may change without prior notice.
5456 : : *
5457 : : * Information about flow engine resources.
5458 : : * The zero value means a resource is not supported.
5459 : : */
5460 : : struct rte_flow_port_info {
5461 : : /**
5462 : : * Maximum number of queues for asynchronous operations.
5463 : : */
5464 : : uint32_t max_nb_queues;
5465 : : /**
5466 : : * Maximum number of counters.
5467 : : * @see RTE_FLOW_ACTION_TYPE_COUNT
5468 : : */
5469 : : uint32_t max_nb_counters;
5470 : : /**
5471 : : * Maximum number of aging objects.
5472 : : * @see RTE_FLOW_ACTION_TYPE_AGE
5473 : : */
5474 : : uint32_t max_nb_aging_objects;
5475 : : /**
5476 : : * Maximum number traffic meters.
5477 : : * @see RTE_FLOW_ACTION_TYPE_METER
5478 : : */
5479 : : uint32_t max_nb_meters;
5480 : : /**
5481 : : * Maximum number connection trackings.
5482 : : * @see RTE_FLOW_ACTION_TYPE_CONNTRACK
5483 : : */
5484 : : uint32_t max_nb_conn_tracks;
5485 : : /**
5486 : : * Maximum number of quota actions.
5487 : : * @see RTE_FLOW_ACTION_TYPE_QUOTA
5488 : : */
5489 : : uint32_t max_nb_quotas;
5490 : : /**
5491 : : * Port supported flags (RTE_FLOW_PORT_FLAG_*).
5492 : : */
5493 : : uint32_t supported_flags;
5494 : : };
5495 : :
5496 : : /**
5497 : : * @warning
5498 : : * @b EXPERIMENTAL: this API may change without prior notice.
5499 : : *
5500 : : * Information about flow engine asynchronous queues.
5501 : : * The value only valid if @p port_attr.max_nb_queues is not zero.
5502 : : */
5503 : : struct rte_flow_queue_info {
5504 : : /**
5505 : : * Maximum number of operations a queue can hold.
5506 : : */
5507 : : uint32_t max_size;
5508 : : };
5509 : :
5510 : : /**
5511 : : * @warning
5512 : : * @b EXPERIMENTAL: this API may change without prior notice.
5513 : : *
5514 : : * Get information about flow engine resources.
5515 : : *
5516 : : * @param port_id
5517 : : * Port identifier of Ethernet device.
5518 : : * @param[out] port_info
5519 : : * A pointer to a structure of type *rte_flow_port_info*
5520 : : * to be filled with the resources information of the port.
5521 : : * @param[out] queue_info
5522 : : * A pointer to a structure of type *rte_flow_queue_info*
5523 : : * to be filled with the asynchronous queues information.
5524 : : * @param[out] error
5525 : : * Perform verbose error reporting if not NULL.
5526 : : * PMDs initialize this structure in case of error only.
5527 : : *
5528 : : * @return
5529 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5530 : : */
5531 : : __rte_experimental
5532 : : int
5533 : : rte_flow_info_get(uint16_t port_id,
5534 : : struct rte_flow_port_info *port_info,
5535 : : struct rte_flow_queue_info *queue_info,
5536 : : struct rte_flow_error *error);
5537 : :
5538 : : /**
5539 : : * @warning
5540 : : * @b EXPERIMENTAL: this API may change without prior notice.
5541 : : *
5542 : : * Flow engine resources settings.
5543 : : * The zero value means on demand resource allocations only.
5544 : : */
5545 : : struct rte_flow_port_attr {
5546 : : /**
5547 : : * Number of counters to configure.
5548 : : * @see RTE_FLOW_ACTION_TYPE_COUNT
5549 : : */
5550 : : uint32_t nb_counters;
5551 : : /**
5552 : : * Number of aging objects to configure.
5553 : : * @see RTE_FLOW_ACTION_TYPE_AGE
5554 : : */
5555 : : uint32_t nb_aging_objects;
5556 : : /**
5557 : : * Number of traffic meters to configure.
5558 : : * @see RTE_FLOW_ACTION_TYPE_METER
5559 : : */
5560 : : uint32_t nb_meters;
5561 : : /**
5562 : : * Number of connection trackings to configure.
5563 : : * @see RTE_FLOW_ACTION_TYPE_CONNTRACK
5564 : : */
5565 : : uint32_t nb_conn_tracks;
5566 : : /**
5567 : : * Port to base shared objects on.
5568 : : */
5569 : : uint16_t host_port_id;
5570 : : /**
5571 : : * Maximum number of quota actions.
5572 : : * @see RTE_FLOW_ACTION_TYPE_QUOTA
5573 : : */
5574 : : uint32_t nb_quotas;
5575 : : /**
5576 : : * Port flags (RTE_FLOW_PORT_FLAG_*).
5577 : : */
5578 : : uint32_t flags;
5579 : : };
5580 : :
5581 : : /**
5582 : : * @warning
5583 : : * @b EXPERIMENTAL: this API may change without prior notice.
5584 : : *
5585 : : * Flow engine asynchronous queues settings.
5586 : : * The value means default value picked by PMD.
5587 : : */
5588 : : struct rte_flow_queue_attr {
5589 : : /**
5590 : : * Number of flow rule operations a queue can hold.
5591 : : */
5592 : : uint32_t size;
5593 : : };
5594 : :
5595 : : /**
5596 : : * @warning
5597 : : * @b EXPERIMENTAL: this API may change without prior notice.
5598 : : *
5599 : : * Configure the port's flow API engine.
5600 : : *
5601 : : * This API can only be invoked before the application
5602 : : * starts using the rest of the flow library functions.
5603 : : *
5604 : : * The API can be invoked multiple times to change the settings.
5605 : : * The port, however, may reject changes and keep the old config.
5606 : : *
5607 : : * Parameters in configuration attributes must not exceed
5608 : : * numbers of resources returned by the rte_flow_info_get API.
5609 : : *
5610 : : * @param port_id
5611 : : * Port identifier of Ethernet device.
5612 : : * @param[in] port_attr
5613 : : * Port configuration attributes.
5614 : : * @param[in] nb_queue
5615 : : * Number of flow queues to be configured.
5616 : : * @param[in] queue_attr
5617 : : * Array that holds attributes for each flow queue.
5618 : : * Number of elements is set in @p port_attr.nb_queues.
5619 : : * @param[out] error
5620 : : * Perform verbose error reporting if not NULL.
5621 : : * PMDs initialize this structure in case of error only.
5622 : : *
5623 : : * @return
5624 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5625 : : */
5626 : : __rte_experimental
5627 : : int
5628 : : rte_flow_configure(uint16_t port_id,
5629 : : const struct rte_flow_port_attr *port_attr,
5630 : : uint16_t nb_queue,
5631 : : const struct rte_flow_queue_attr *queue_attr[],
5632 : : struct rte_flow_error *error);
5633 : :
5634 : : /**
5635 : : * Opaque type returned after successful creation of pattern template.
5636 : : * This handle can be used to manage the created pattern template.
5637 : : */
5638 : : struct rte_flow_pattern_template;
5639 : :
5640 : : /**
5641 : : * @warning
5642 : : * @b EXPERIMENTAL: this API may change without prior notice.
5643 : : *
5644 : : * Flow pattern template attributes.
5645 : : */
5646 : : __extension__
5647 : : struct rte_flow_pattern_template_attr {
5648 : : /**
5649 : : * Relaxed matching policy.
5650 : : * - If 1, matching is performed only on items with the mask member set
5651 : : * and matching on protocol layers specified without any masks is skipped.
5652 : : * - If 0, matching on protocol layers specified without any masks is done
5653 : : * as well. This is the standard behaviour of Flow API now.
5654 : : */
5655 : : uint32_t relaxed_matching:1;
5656 : : /**
5657 : : * Flow direction for the pattern template.
5658 : : * At least one direction must be specified.
5659 : : */
5660 : : /** Pattern valid for rules applied to ingress traffic. */
5661 : : uint32_t ingress:1;
5662 : : /** Pattern valid for rules applied to egress traffic. */
5663 : : uint32_t egress:1;
5664 : : /** Pattern valid for rules applied to transfer traffic. */
5665 : : uint32_t transfer:1;
5666 : : };
5667 : :
5668 : : /**
5669 : : * @warning
5670 : : * @b EXPERIMENTAL: this API may change without prior notice.
5671 : : *
5672 : : * Create flow pattern template.
5673 : : *
5674 : : * The pattern template defines common matching fields without values.
5675 : : * For example, matching on 5 tuple TCP flow, the template will be
5676 : : * eth(null) + IPv4(source + dest) + TCP(s_port + d_port),
5677 : : * while values for each rule will be set during the flow rule creation.
5678 : : * The number and order of items in the template must be the same
5679 : : * at the rule creation.
5680 : : *
5681 : : * @param port_id
5682 : : * Port identifier of Ethernet device.
5683 : : * @param[in] template_attr
5684 : : * Pattern template attributes.
5685 : : * @param[in] pattern
5686 : : * Pattern specification (list terminated by the END pattern item).
5687 : : * The spec member of an item is not used unless the end member is used.
5688 : : * @param[out] error
5689 : : * Perform verbose error reporting if not NULL.
5690 : : * PMDs initialize this structure in case of error only.
5691 : : *
5692 : : * @return
5693 : : * Handle on success, NULL otherwise and rte_errno is set.
5694 : : */
5695 : : __rte_experimental
5696 : : struct rte_flow_pattern_template *
5697 : : rte_flow_pattern_template_create(uint16_t port_id,
5698 : : const struct rte_flow_pattern_template_attr *template_attr,
5699 : : const struct rte_flow_item pattern[],
5700 : : struct rte_flow_error *error);
5701 : :
5702 : : /**
5703 : : * @warning
5704 : : * @b EXPERIMENTAL: this API may change without prior notice.
5705 : : *
5706 : : * Destroy flow pattern template.
5707 : : *
5708 : : * This function may be called only when
5709 : : * there are no more tables referencing this template.
5710 : : *
5711 : : * @param port_id
5712 : : * Port identifier of Ethernet device.
5713 : : * @param[in] pattern_template
5714 : : * Handle of the template to be destroyed.
5715 : : * @param[out] error
5716 : : * Perform verbose error reporting if not NULL.
5717 : : * PMDs initialize this structure in case of error only.
5718 : : *
5719 : : * @return
5720 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5721 : : */
5722 : : __rte_experimental
5723 : : int
5724 : : rte_flow_pattern_template_destroy(uint16_t port_id,
5725 : : struct rte_flow_pattern_template *pattern_template,
5726 : : struct rte_flow_error *error);
5727 : :
5728 : : /**
5729 : : * Opaque type returned after successful creation of actions template.
5730 : : * This handle can be used to manage the created actions template.
5731 : : */
5732 : : struct rte_flow_actions_template;
5733 : :
5734 : : /**
5735 : : * @warning
5736 : : * @b EXPERIMENTAL: this API may change without prior notice.
5737 : : *
5738 : : * Flow actions template attributes.
5739 : : */
5740 : : __extension__
5741 : : struct rte_flow_actions_template_attr {
5742 : : /**
5743 : : * Flow direction for the actions template.
5744 : : * At least one direction must be specified.
5745 : : */
5746 : : /** Action valid for rules applied to ingress traffic. */
5747 : : uint32_t ingress:1;
5748 : : /** Action valid for rules applied to egress traffic. */
5749 : : uint32_t egress:1;
5750 : : /** Action valid for rules applied to transfer traffic. */
5751 : : uint32_t transfer:1;
5752 : : };
5753 : :
5754 : : /**
5755 : : * @warning
5756 : : * @b EXPERIMENTAL: this API may change without prior notice.
5757 : : *
5758 : : * Create flow actions template.
5759 : : *
5760 : : * The actions template holds a list of action types without values.
5761 : : * For example, the template to change TCP ports is TCP(s_port + d_port),
5762 : : * while values for each rule will be set during the flow rule creation.
5763 : : * The number and order of actions in the template must be the same
5764 : : * at the rule creation.
5765 : : *
5766 : : * @param port_id
5767 : : * Port identifier of Ethernet device.
5768 : : * @param[in] template_attr
5769 : : * Template attributes.
5770 : : * @param[in] actions
5771 : : * Associated actions (list terminated by the END action).
5772 : : * The spec member is only used if @p masks spec is non-zero.
5773 : : * @param[in] masks
5774 : : * List of actions that marks which of the action's member is constant.
5775 : : * A mask has the same format as the corresponding action.
5776 : : * If the action field in @p masks is not 0,
5777 : : * the corresponding value in an action from @p actions will be the part
5778 : : * of the template and used in all flow rules.
5779 : : * The order of actions in @p masks is the same as in @p actions.
5780 : : * In case of indirect actions present in @p actions,
5781 : : * the actual action type should be present in @p mask.
5782 : : * @param[out] error
5783 : : * Perform verbose error reporting if not NULL.
5784 : : * PMDs initialize this structure in case of error only.
5785 : : *
5786 : : * @return
5787 : : * Handle on success, NULL otherwise and rte_errno is set.
5788 : : */
5789 : : __rte_experimental
5790 : : struct rte_flow_actions_template *
5791 : : rte_flow_actions_template_create(uint16_t port_id,
5792 : : const struct rte_flow_actions_template_attr *template_attr,
5793 : : const struct rte_flow_action actions[],
5794 : : const struct rte_flow_action masks[],
5795 : : struct rte_flow_error *error);
5796 : :
5797 : : /**
5798 : : * @warning
5799 : : * @b EXPERIMENTAL: this API may change without prior notice.
5800 : : *
5801 : : * Destroy flow actions template.
5802 : : *
5803 : : * This function may be called only when
5804 : : * there are no more tables referencing this template.
5805 : : *
5806 : : * @param port_id
5807 : : * Port identifier of Ethernet device.
5808 : : * @param[in] actions_template
5809 : : * Handle to the template to be destroyed.
5810 : : * @param[out] error
5811 : : * Perform verbose error reporting if not NULL.
5812 : : * PMDs initialize this structure in case of error only.
5813 : : *
5814 : : * @return
5815 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
5816 : : */
5817 : : __rte_experimental
5818 : : int
5819 : : rte_flow_actions_template_destroy(uint16_t port_id,
5820 : : struct rte_flow_actions_template *actions_template,
5821 : : struct rte_flow_error *error);
5822 : :
5823 : : /**
5824 : : * Opaque type returned after successful creation of a template table.
5825 : : * This handle can be used to manage the created template table.
5826 : : */
5827 : : struct rte_flow_template_table;
5828 : :
5829 : : /**@{@name Flags for template table attribute.
5830 : : * Each bit is an optional hint for table specialization,
5831 : : * offering a potential optimization at driver layer.
5832 : : * The driver can ignore the hints silently.
5833 : : * The hints do not replace any matching criteria.
5834 : : */
5835 : : /**
5836 : : * Specialize table for transfer flows which come only from wire.
5837 : : * It allows PMD not to allocate resources for non-wire originated traffic.
5838 : : * This bit is not a matching criteria, just an optimization hint.
5839 : : * Flow rules which match non-wire originated traffic will be missed
5840 : : * if the hint is supported.
5841 : : */
5842 : : #define RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG RTE_BIT32(0)
5843 : : /**
5844 : : * Specialize table for transfer flows which come only from vport (e.g. VF, SF).
5845 : : * It allows PMD not to allocate resources for non-vport originated traffic.
5846 : : * This bit is not a matching criteria, just an optimization hint.
5847 : : * Flow rules which match non-vport originated traffic will be missed
5848 : : * if the hint is supported.
5849 : : */
5850 : : #define RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG RTE_BIT32(1)
5851 : : /**
5852 : : * Specialize table for resize.
5853 : : */
5854 : : #define RTE_FLOW_TABLE_SPECIALIZE_RESIZABLE RTE_BIT32(2)
5855 : : /**@}*/
5856 : :
5857 : : /**
5858 : : * @warning
5859 : : * @b EXPERIMENTAL: this API may change without prior notice.
5860 : : *
5861 : : * Template table flow rules insertion type.
5862 : : */
5863 : : enum rte_flow_table_insertion_type {
5864 : : /**
5865 : : * Pattern-based insertion.
5866 : : */
5867 : : RTE_FLOW_TABLE_INSERTION_TYPE_PATTERN,
5868 : : /**
5869 : : * Index-based insertion.
5870 : : */
5871 : : RTE_FLOW_TABLE_INSERTION_TYPE_INDEX,
5872 : : };
5873 : :
5874 : : /**
5875 : : * @warning
5876 : : * @b EXPERIMENTAL: this API may change without prior notice.
5877 : : *
5878 : : * Template table hash index calculation function.
5879 : : */
5880 : : enum rte_flow_table_hash_func {
5881 : : /**
5882 : : * Default hash calculation.
5883 : : */
5884 : : RTE_FLOW_TABLE_HASH_FUNC_DEFAULT,
5885 : : /**
5886 : : * Linear hash calculation.
5887 : : */
5888 : : RTE_FLOW_TABLE_HASH_FUNC_LINEAR,
5889 : : /**
5890 : : * 32-bit checksum hash calculation.
5891 : : */
5892 : : RTE_FLOW_TABLE_HASH_FUNC_CRC32,
5893 : : /**
5894 : : * 16-bit checksum hash calculation.
5895 : : */
5896 : : RTE_FLOW_TABLE_HASH_FUNC_CRC16,
5897 : : };
5898 : :
5899 : : /**
5900 : : * @warning
5901 : : * @b EXPERIMENTAL: this API may change without prior notice.
5902 : : *
5903 : : * Table attributes.
5904 : : */
5905 : : struct rte_flow_template_table_attr {
5906 : : /**
5907 : : * Flow attributes to be used in each rule generated from this table.
5908 : : */
5909 : : struct rte_flow_attr flow_attr;
5910 : : /**
5911 : : * Maximum number of flow rules that this table holds.
5912 : : */
5913 : : uint32_t nb_flows;
5914 : : /**
5915 : : * Optional hint flags for driver optimization.
5916 : : * The effect may vary in the different drivers.
5917 : : * The functionality must not rely on the hints.
5918 : : * Value is composed with RTE_FLOW_TABLE_SPECIALIZE_* based on application
5919 : : * design choices.
5920 : : * Misused hints may mislead the driver, it may result in an undefined behavior.
5921 : : */
5922 : : uint32_t specialize;
5923 : : /**
5924 : : * Insertion type for flow rules.
5925 : : */
5926 : : enum rte_flow_table_insertion_type insertion_type;
5927 : : /**
5928 : : * Hash calculation function for the packet matching.
5929 : : */
5930 : : enum rte_flow_table_hash_func hash_func;
5931 : : };
5932 : :
5933 : : /**
5934 : : * @warning
5935 : : * @b EXPERIMENTAL: this API may change without prior notice.
5936 : : *
5937 : : * Query whether a table can be resized.
5938 : : *
5939 : : * @param port_id
5940 : : * Port identifier of Ethernet device.
5941 : : * @param tbl_attr
5942 : : * Template table.
5943 : : *
5944 : : * @return
5945 : : * True if the table can be resized.
5946 : : */
5947 : : __rte_experimental
5948 : : bool
5949 : : rte_flow_template_table_resizable(__rte_unused uint16_t port_id,
5950 : : const struct rte_flow_template_table_attr *tbl_attr);
5951 : :
5952 : : /**
5953 : : * @warning
5954 : : * @b EXPERIMENTAL: this API may change without prior notice.
5955 : : *
5956 : : * Create flow template table.
5957 : : *
5958 : : * A template table consists of multiple pattern templates and actions
5959 : : * templates associated with a single set of rule attributes (group ID,
5960 : : * priority and traffic direction).
5961 : : *
5962 : : * Each rule is free to use any combination of pattern and actions templates
5963 : : * and specify particular values for items and actions it would like to change.
5964 : : *
5965 : : * @param port_id
5966 : : * Port identifier of Ethernet device.
5967 : : * @param[in] table_attr
5968 : : * Template table attributes.
5969 : : * @param[in] pattern_templates
5970 : : * Array of pattern templates to be used in this table.
5971 : : * @param[in] nb_pattern_templates
5972 : : * The number of pattern templates in the pattern_templates array.
5973 : : * @param[in] actions_templates
5974 : : * Array of actions templates to be used in this table.
5975 : : * @param[in] nb_actions_templates
5976 : : * The number of actions templates in the actions_templates array.
5977 : : * @param[out] error
5978 : : * Perform verbose error reporting if not NULL.
5979 : : * PMDs initialize this structure in case of error only.
5980 : : *
5981 : : * @return
5982 : : * Handle on success, NULL otherwise and rte_errno is set.
5983 : : */
5984 : : __rte_experimental
5985 : : struct rte_flow_template_table *
5986 : : rte_flow_template_table_create(uint16_t port_id,
5987 : : const struct rte_flow_template_table_attr *table_attr,
5988 : : struct rte_flow_pattern_template *pattern_templates[],
5989 : : uint8_t nb_pattern_templates,
5990 : : struct rte_flow_actions_template *actions_templates[],
5991 : : uint8_t nb_actions_templates,
5992 : : struct rte_flow_error *error);
5993 : :
5994 : : /**
5995 : : * @warning
5996 : : * @b EXPERIMENTAL: this API may change without prior notice.
5997 : : *
5998 : : * Destroy flow template table.
5999 : : *
6000 : : * This function may be called only when
6001 : : * there are no more flow rules referencing this table.
6002 : : *
6003 : : * @param port_id
6004 : : * Port identifier of Ethernet device.
6005 : : * @param[in] template_table
6006 : : * Handle to the table to be destroyed.
6007 : : * @param[out] error
6008 : : * Perform verbose error reporting if not NULL.
6009 : : * PMDs initialize this structure in case of error only.
6010 : : *
6011 : : * @return
6012 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6013 : : */
6014 : : __rte_experimental
6015 : : int
6016 : : rte_flow_template_table_destroy(uint16_t port_id,
6017 : : struct rte_flow_template_table *template_table,
6018 : : struct rte_flow_error *error);
6019 : :
6020 : : /**
6021 : : * @warning
6022 : : * @b EXPERIMENTAL: this API may change without prior notice.
6023 : : *
6024 : : * Set group miss actions.
6025 : : *
6026 : : * @param port_id
6027 : : * Port identifier of Ethernet device.
6028 : : * @param group_id
6029 : : * Identifier of a group to set miss actions for.
6030 : : * @param attr
6031 : : * Group attributes.
6032 : : * @param actions
6033 : : * List of group miss actions.
6034 : : * @param[out] error
6035 : : * Perform verbose error reporting if not NULL.
6036 : : * PMDs initialize this structure in case of error only.
6037 : : *
6038 : : * @return
6039 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6040 : : */
6041 : : __rte_experimental
6042 : : int
6043 : : rte_flow_group_set_miss_actions(uint16_t port_id,
6044 : : uint32_t group_id,
6045 : : const struct rte_flow_group_attr *attr,
6046 : : const struct rte_flow_action actions[],
6047 : : struct rte_flow_error *error);
6048 : :
6049 : : /**
6050 : : * @warning
6051 : : * @b EXPERIMENTAL: this API may change without prior notice.
6052 : : *
6053 : : * Asynchronous operation attributes.
6054 : : */
6055 : : __extension__
6056 : : struct rte_flow_op_attr {
6057 : : /**
6058 : : * When set, the requested action will not be sent to the HW immediately.
6059 : : * The application must call the rte_flow_queue_push to actually send it.
6060 : : */
6061 : : uint32_t postpone:1;
6062 : : };
6063 : :
6064 : : /**
6065 : : * @warning
6066 : : * @b EXPERIMENTAL: this API may change without prior notice.
6067 : : *
6068 : : * Enqueue rule creation operation.
6069 : : *
6070 : : * @param port_id
6071 : : * Port identifier of Ethernet device.
6072 : : * @param queue_id
6073 : : * Flow queue used to insert the rule.
6074 : : * @param[in] op_attr
6075 : : * Rule creation operation attributes.
6076 : : * @param[in] template_table
6077 : : * Template table to select templates from.
6078 : : * @param[in] pattern
6079 : : * List of pattern items to be used.
6080 : : * The list order should match the order in the pattern template.
6081 : : * The spec is the only relevant member of the item that is being used.
6082 : : * @param[in] pattern_template_index
6083 : : * Pattern template index in the table.
6084 : : * @param[in] actions
6085 : : * List of actions to be used.
6086 : : * The list order should match the order in the actions template.
6087 : : * @param[in] actions_template_index
6088 : : * Actions template index in the table.
6089 : : * @param[in] user_data
6090 : : * The user data that will be returned on the completion events.
6091 : : * @param[out] error
6092 : : * Perform verbose error reporting if not NULL.
6093 : : * PMDs initialize this structure in case of error only.
6094 : : *
6095 : : * @return
6096 : : * Handle on success, NULL otherwise and rte_errno is set.
6097 : : * The rule handle doesn't mean that the rule has been populated.
6098 : : * Only completion result indicates that if there was success or failure.
6099 : : */
6100 : : __rte_experimental
6101 : : struct rte_flow *
6102 : : rte_flow_async_create(uint16_t port_id,
6103 : : uint32_t queue_id,
6104 : : const struct rte_flow_op_attr *op_attr,
6105 : : struct rte_flow_template_table *template_table,
6106 : : const struct rte_flow_item pattern[],
6107 : : uint8_t pattern_template_index,
6108 : : const struct rte_flow_action actions[],
6109 : : uint8_t actions_template_index,
6110 : : void *user_data,
6111 : : struct rte_flow_error *error);
6112 : :
6113 : : /**
6114 : : * @warning
6115 : : * @b EXPERIMENTAL: this API may change without prior notice.
6116 : : *
6117 : : * Enqueue rule creation operation.
6118 : : *
6119 : : * @param port_id
6120 : : * Port identifier of Ethernet device.
6121 : : * @param queue_id
6122 : : * Flow queue used to insert the rule.
6123 : : * @param[in] op_attr
6124 : : * Rule creation operation attributes.
6125 : : * @param[in] template_table
6126 : : * Template table to select templates from.
6127 : : * @param[in] rule_index
6128 : : * Rule index in the table.
6129 : : * @param[in] actions
6130 : : * List of actions to be used.
6131 : : * The list order should match the order in the actions template.
6132 : : * @param[in] actions_template_index
6133 : : * Actions template index in the table.
6134 : : * @param[in] user_data
6135 : : * The user data that will be returned on the completion events.
6136 : : * @param[out] error
6137 : : * Perform verbose error reporting if not NULL.
6138 : : * PMDs initialize this structure in case of error only.
6139 : : *
6140 : : * @return
6141 : : * Handle on success, NULL otherwise and rte_errno is set.
6142 : : * The rule handle doesn't mean that the rule has been populated.
6143 : : * Only completion result indicates that if there was success or failure.
6144 : : */
6145 : : __rte_experimental
6146 : : struct rte_flow *
6147 : : rte_flow_async_create_by_index(uint16_t port_id,
6148 : : uint32_t queue_id,
6149 : : const struct rte_flow_op_attr *op_attr,
6150 : : struct rte_flow_template_table *template_table,
6151 : : uint32_t rule_index,
6152 : : const struct rte_flow_action actions[],
6153 : : uint8_t actions_template_index,
6154 : : void *user_data,
6155 : : struct rte_flow_error *error);
6156 : :
6157 : : /**
6158 : : * @warning
6159 : : * @b EXPERIMENTAL: this API may change without prior notice.
6160 : : *
6161 : : * Enqueue rule destruction operation.
6162 : : *
6163 : : * This function enqueues a destruction operation on the queue.
6164 : : * Application should assume that after calling this function
6165 : : * the rule handle is not valid anymore.
6166 : : * Completion indicates the full removal of the rule from the HW.
6167 : : *
6168 : : * @param port_id
6169 : : * Port identifier of Ethernet device.
6170 : : * @param queue_id
6171 : : * Flow queue which is used to destroy the rule.
6172 : : * This must match the queue on which the rule was created.
6173 : : * @param[in] op_attr
6174 : : * Rule destruction operation attributes.
6175 : : * @param[in] flow
6176 : : * Flow handle to be destroyed.
6177 : : * @param[in] user_data
6178 : : * The user data that will be returned on the completion events.
6179 : : * @param[out] error
6180 : : * Perform verbose error reporting if not NULL.
6181 : : * PMDs initialize this structure in case of error only.
6182 : : *
6183 : : * @return
6184 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6185 : : */
6186 : : __rte_experimental
6187 : : int
6188 : : rte_flow_async_destroy(uint16_t port_id,
6189 : : uint32_t queue_id,
6190 : : const struct rte_flow_op_attr *op_attr,
6191 : : struct rte_flow *flow,
6192 : : void *user_data,
6193 : : struct rte_flow_error *error);
6194 : :
6195 : : /**
6196 : : * @warning
6197 : : * @b EXPERIMENTAL: this API may change without prior notice.
6198 : : *
6199 : : * Enqueue rule update operation.
6200 : : *
6201 : : * @param port_id
6202 : : * Port identifier of Ethernet device.
6203 : : * @param queue_id
6204 : : * Flow queue used to insert the rule.
6205 : : * @param[in] op_attr
6206 : : * Rule creation operation attributes.
6207 : : * @param[in] flow
6208 : : * Flow rule to be updated.
6209 : : * @param[in] actions
6210 : : * List of actions to be used.
6211 : : * The list order should match the order in the actions template.
6212 : : * @param[in] actions_template_index
6213 : : * Actions template index in the table.
6214 : : * @param[in] user_data
6215 : : * The user data that will be returned on the completion events.
6216 : : * @param[out] error
6217 : : * Perform verbose error reporting if not NULL.
6218 : : * PMDs initialize this structure in case of error only.
6219 : : *
6220 : : * @return
6221 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6222 : : */
6223 : : __rte_experimental
6224 : : int
6225 : : rte_flow_async_actions_update(uint16_t port_id,
6226 : : uint32_t queue_id,
6227 : : const struct rte_flow_op_attr *op_attr,
6228 : : struct rte_flow *flow,
6229 : : const struct rte_flow_action actions[],
6230 : : uint8_t actions_template_index,
6231 : : void *user_data,
6232 : : struct rte_flow_error *error);
6233 : :
6234 : : /**
6235 : : * @warning
6236 : : * @b EXPERIMENTAL: this API may change without prior notice.
6237 : : *
6238 : : * Push all internally stored rules to the HW.
6239 : : * Postponed rules are rules that were inserted with the postpone flag set.
6240 : : * Can be used to notify the HW about batch of rules prepared by the SW to
6241 : : * reduce the number of communications between the HW and SW.
6242 : : *
6243 : : * @param port_id
6244 : : * Port identifier of Ethernet device.
6245 : : * @param queue_id
6246 : : * Flow queue to be pushed.
6247 : : * @param[out] error
6248 : : * Perform verbose error reporting if not NULL.
6249 : : * PMDs initialize this structure in case of error only.
6250 : : *
6251 : : * @return
6252 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6253 : : */
6254 : : __rte_experimental
6255 : : int
6256 : : rte_flow_push(uint16_t port_id,
6257 : : uint32_t queue_id,
6258 : : struct rte_flow_error *error);
6259 : :
6260 : : /**
6261 : : * @warning
6262 : : * @b EXPERIMENTAL: this API may change without prior notice.
6263 : : *
6264 : : * Asynchronous operation status.
6265 : : */
6266 : : enum rte_flow_op_status {
6267 : : /**
6268 : : * The operation was completed successfully.
6269 : : */
6270 : : RTE_FLOW_OP_SUCCESS,
6271 : : /**
6272 : : * The operation was not completed successfully.
6273 : : */
6274 : : RTE_FLOW_OP_ERROR,
6275 : : };
6276 : :
6277 : : /**
6278 : : * @warning
6279 : : * @b EXPERIMENTAL: this API may change without prior notice.
6280 : : *
6281 : : * Asynchronous operation result.
6282 : : */
6283 : : __extension__
6284 : : struct rte_flow_op_result {
6285 : : /**
6286 : : * Returns the status of the operation that this completion signals.
6287 : : */
6288 : : enum rte_flow_op_status status;
6289 : : /**
6290 : : * The user data that will be returned on the completion events.
6291 : : */
6292 : : void *user_data;
6293 : : };
6294 : :
6295 : : /**
6296 : : * @warning
6297 : : * @b EXPERIMENTAL: this API may change without prior notice.
6298 : : *
6299 : : * Pull a rte flow operation.
6300 : : * The application must invoke this function in order to complete
6301 : : * the flow rule offloading and to retrieve the flow rule operation status.
6302 : : *
6303 : : * @param port_id
6304 : : * Port identifier of Ethernet device.
6305 : : * @param queue_id
6306 : : * Flow queue which is used to pull the operation.
6307 : : * @param[out] res
6308 : : * Array of results that will be set.
6309 : : * @param[in] n_res
6310 : : * Maximum number of results that can be returned.
6311 : : * This value is equal to the size of the res array.
6312 : : * @param[out] error
6313 : : * Perform verbose error reporting if not NULL.
6314 : : * PMDs initialize this structure in case of error only.
6315 : : *
6316 : : * @return
6317 : : * Number of results that were pulled,
6318 : : * a negative errno value otherwise and rte_errno is set.
6319 : : */
6320 : : __rte_experimental
6321 : : int
6322 : : rte_flow_pull(uint16_t port_id,
6323 : : uint32_t queue_id,
6324 : : struct rte_flow_op_result res[],
6325 : : uint16_t n_res,
6326 : : struct rte_flow_error *error);
6327 : :
6328 : : /**
6329 : : * @warning
6330 : : * @b EXPERIMENTAL: this API may change without prior notice.
6331 : : *
6332 : : * Enqueue indirect action creation operation.
6333 : : * @see rte_flow_action_handle_create
6334 : : *
6335 : : * @param[in] port_id
6336 : : * Port identifier of Ethernet device.
6337 : : * @param[in] queue_id
6338 : : * Flow queue which is used to create the rule.
6339 : : * @param[in] op_attr
6340 : : * Indirect action creation operation attributes.
6341 : : * @param[in] indir_action_conf
6342 : : * Action configuration for the indirect action object creation.
6343 : : * @param[in] action
6344 : : * Specific configuration of the indirect action object.
6345 : : * @param[in] user_data
6346 : : * The user data that will be returned on the completion events.
6347 : : * @param[out] error
6348 : : * Perform verbose error reporting if not NULL.
6349 : : * PMDs initialize this structure in case of error only.
6350 : : *
6351 : : * @return
6352 : : * A valid handle in case of success, NULL otherwise and rte_errno is set.
6353 : : */
6354 : : __rte_experimental
6355 : : struct rte_flow_action_handle *
6356 : : rte_flow_async_action_handle_create(uint16_t port_id,
6357 : : uint32_t queue_id,
6358 : : const struct rte_flow_op_attr *op_attr,
6359 : : const struct rte_flow_indir_action_conf *indir_action_conf,
6360 : : const struct rte_flow_action *action,
6361 : : void *user_data,
6362 : : struct rte_flow_error *error);
6363 : :
6364 : : /**
6365 : : * @warning
6366 : : * @b EXPERIMENTAL: this API may change without prior notice.
6367 : : *
6368 : : * Enqueue indirect action destruction operation.
6369 : : * The destroy queue must be the same
6370 : : * as the queue on which the action was created.
6371 : : *
6372 : : * @param[in] port_id
6373 : : * Port identifier of Ethernet device.
6374 : : * @param[in] queue_id
6375 : : * Flow queue which is used to destroy the rule.
6376 : : * @param[in] op_attr
6377 : : * Indirect action destruction operation attributes.
6378 : : * @param[in] action_handle
6379 : : * Handle for the indirect action object to be destroyed.
6380 : : * @param[in] user_data
6381 : : * The user data that will be returned on the completion events.
6382 : : * @param[out] error
6383 : : * Perform verbose error reporting if not NULL.
6384 : : * PMDs initialize this structure in case of error only.
6385 : : *
6386 : : * @return
6387 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6388 : : */
6389 : : __rte_experimental
6390 : : int
6391 : : rte_flow_async_action_handle_destroy(uint16_t port_id,
6392 : : uint32_t queue_id,
6393 : : const struct rte_flow_op_attr *op_attr,
6394 : : struct rte_flow_action_handle *action_handle,
6395 : : void *user_data,
6396 : : struct rte_flow_error *error);
6397 : :
6398 : : /**
6399 : : * @warning
6400 : : * @b EXPERIMENTAL: this API may change without prior notice.
6401 : : *
6402 : : * Enqueue indirect action update operation.
6403 : : * @see rte_flow_action_handle_create
6404 : : *
6405 : : * @param[in] port_id
6406 : : * Port identifier of Ethernet device.
6407 : : * @param[in] queue_id
6408 : : * Flow queue which is used to update the rule.
6409 : : * @param[in] op_attr
6410 : : * Indirect action update operation attributes.
6411 : : * @param[in] action_handle
6412 : : * Handle for the indirect action object to be updated.
6413 : : * @param[in] update
6414 : : * Update profile specification used to modify the action pointed by handle.
6415 : : * *update* could be with the same type of the immediate action corresponding
6416 : : * to the *handle* argument when creating, or a wrapper structure includes
6417 : : * action configuration to be updated and bit fields to indicate the member
6418 : : * of fields inside the action to update.
6419 : : * @param[in] user_data
6420 : : * The user data that will be returned on the completion events.
6421 : : * @param[out] error
6422 : : * Perform verbose error reporting if not NULL.
6423 : : * PMDs initialize this structure in case of error only.
6424 : : *
6425 : : * @return
6426 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6427 : : */
6428 : : __rte_experimental
6429 : : int
6430 : : rte_flow_async_action_handle_update(uint16_t port_id,
6431 : : uint32_t queue_id,
6432 : : const struct rte_flow_op_attr *op_attr,
6433 : : struct rte_flow_action_handle *action_handle,
6434 : : const void *update,
6435 : : void *user_data,
6436 : : struct rte_flow_error *error);
6437 : :
6438 : : /**
6439 : : * @warning
6440 : : * @b EXPERIMENTAL: this API may change without prior notice.
6441 : : *
6442 : : * Enqueue indirect action query operation.
6443 : : *
6444 : : * Retrieve action-specific data such as counters.
6445 : : * Data is gathered by special action which may be present/referenced in
6446 : : * more than one flow rule definition.
6447 : : * Data will be available only when completion event returns.
6448 : : *
6449 : : * @see rte_flow_async_action_handle_query
6450 : : *
6451 : : * @param port_id
6452 : : * Port identifier of Ethernet device.
6453 : : * @param[in] queue_id
6454 : : * Flow queue which is used to query the action.
6455 : : * @param[in] op_attr
6456 : : * Indirect action update operation attributes.
6457 : : * @param[in] action_handle
6458 : : * Handle for the action object to query.
6459 : : * @param[in, out] data
6460 : : * Pointer to storage for the associated query data type.
6461 : : * The out data will be available only when completion event returns
6462 : : * from rte_flow_pull.
6463 : : * @param[in] user_data
6464 : : * The user data that will be returned on the completion events.
6465 : : * @param[out] error
6466 : : * Perform verbose error reporting if not NULL. PMDs initialize this
6467 : : * structure in case of error only.
6468 : : *
6469 : : * @return
6470 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6471 : : */
6472 : : __rte_experimental
6473 : : int
6474 : : rte_flow_async_action_handle_query(uint16_t port_id,
6475 : : uint32_t queue_id,
6476 : : const struct rte_flow_op_attr *op_attr,
6477 : : const struct rte_flow_action_handle *action_handle,
6478 : : void *data,
6479 : : void *user_data,
6480 : : struct rte_flow_error *error);
6481 : :
6482 : : /**
6483 : : * @warning
6484 : : * @b EXPERIMENTAL: this API may change without prior notice.
6485 : : *
6486 : : * Query and update operational mode.
6487 : : *
6488 : : * @see rte_flow_action_handle_query_update()
6489 : : * @see rte_flow_async_action_handle_query_update()
6490 : : */
6491 : : enum rte_flow_query_update_mode {
6492 : : RTE_FLOW_QU_QUERY_FIRST = 1, /**< Query before update. */
6493 : : RTE_FLOW_QU_UPDATE_FIRST, /**< Query after update. */
6494 : : };
6495 : :
6496 : : /**
6497 : : * @warning
6498 : : * @b EXPERIMENTAL: this API may change without prior notice.
6499 : : *
6500 : : * Query and/or update indirect flow action.
6501 : : * If both query and update not NULL, the function atomically
6502 : : * queries and updates indirect action. Query and update are carried in order
6503 : : * specified in the mode parameter.
6504 : : * If ether query or update is NULL, the function executes
6505 : : * complementing operation.
6506 : : *
6507 : : * @param port_id
6508 : : * Port identifier of Ethernet device.
6509 : : * @param handle
6510 : : * Handle for the indirect action object to be updated.
6511 : : * @param update
6512 : : * If not NULL, update profile specification used to modify the action
6513 : : * pointed by handle.
6514 : : * @param query
6515 : : * If not NULL pointer to storage for the associated query data type.
6516 : : * @param mode
6517 : : * Operational mode.
6518 : : * @param error
6519 : : * Perform verbose error reporting if not NULL.
6520 : : * PMDs initialize this structure in case of error only.
6521 : : *
6522 : : * @return
6523 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6524 : : * - (-ENODEV) if *port_id* invalid.
6525 : : * - (-ENOTSUP) if underlying device does not support this functionality.
6526 : : * - (-EINVAL) if *handle* or *mode* invalid or
6527 : : * both *query* and *update* are NULL.
6528 : : */
6529 : : __rte_experimental
6530 : : int
6531 : : rte_flow_action_handle_query_update(uint16_t port_id,
6532 : : struct rte_flow_action_handle *handle,
6533 : : const void *update, void *query,
6534 : : enum rte_flow_query_update_mode mode,
6535 : : struct rte_flow_error *error);
6536 : :
6537 : : /**
6538 : : * @warning
6539 : : * @b EXPERIMENTAL: this API may change without prior notice.
6540 : : *
6541 : : * Enqueue async indirect flow action query and/or update
6542 : : *
6543 : : * @param port_id
6544 : : * Port identifier of Ethernet device.
6545 : : * @param queue_id
6546 : : * Flow queue which is used to update the rule.
6547 : : * @param attr
6548 : : * Indirect action update operation attributes.
6549 : : * @param handle
6550 : : * Handle for the indirect action object to be updated.
6551 : : * @param update
6552 : : * If not NULL, update profile specification used to modify the action
6553 : : * pointed by handle.
6554 : : * @param query
6555 : : * If not NULL, pointer to storage for the associated query data type.
6556 : : * Query result returned on async completion event.
6557 : : * @param mode
6558 : : * Operational mode.
6559 : : * @param user_data
6560 : : * The user data that will be returned on async completion event.
6561 : : * @param error
6562 : : * Perform verbose error reporting if not NULL.
6563 : : * PMDs initialize this structure in case of error only.
6564 : : *
6565 : : * @return
6566 : : * 0 on success, a negative errno value otherwise and rte_errno is set.
6567 : : * - (-ENODEV) if *port_id* invalid.
6568 : : * - (-ENOTSUP) if underlying device does not support this functionality.
6569 : : * - (-EINVAL) if *handle* or *mode* invalid or
6570 : : * both *update* and *query* are NULL.
6571 : : */
6572 : : __rte_experimental
6573 : : int
6574 : : rte_flow_async_action_handle_query_update(uint16_t port_id, uint32_t queue_id,
6575 : : const struct rte_flow_op_attr *attr,
6576 : : struct rte_flow_action_handle *handle,
6577 : : const void *update, void *query,
6578 : : enum rte_flow_query_update_mode mode,
6579 : : void *user_data,
6580 : : struct rte_flow_error *error);
6581 : :
6582 : : struct rte_flow_action_list_handle;
6583 : :
6584 : : /**
6585 : : * @warning
6586 : : * @b EXPERIMENTAL: this API may change without prior notice.
6587 : : *
6588 : : * Configure INDIRECT_LIST flow action.
6589 : : *
6590 : : * @see RTE_FLOW_ACTION_TYPE_INDIRECT_LIST
6591 : : */
6592 : : struct rte_flow_action_indirect_list {
6593 : : /** Indirect action list handle */
6594 : : struct rte_flow_action_list_handle *handle;
6595 : : /**
6596 : : * Flow mutable configuration array.
6597 : : * NULL if the handle has no flow mutable configuration update.
6598 : : * Otherwise, if the handle was created with list A1 / A2 .. An / END
6599 : : * size of conf is n.
6600 : : * conf[i] points to flow mutable update of Ai in the handle
6601 : : * actions list or NULL if Ai has no update.
6602 : : */
6603 : : const void **conf;
6604 : : };
6605 : :
6606 : : /**
6607 : : * @warning
6608 : : * @b EXPERIMENTAL: this API may change without prior notice.
6609 : : *
6610 : : * Create an indirect flow action object from flow actions list.
6611 : : * The object is identified by a unique handle.
6612 : : * The handle has single state and configuration
6613 : : * across all the flow rules using it.
6614 : : *
6615 : : * @param[in] port_id
6616 : : * The port identifier of the Ethernet device.
6617 : : * @param[in] conf
6618 : : * Action configuration for the indirect action list creation.
6619 : : * @param[in] actions
6620 : : * Specific configuration of the indirect action lists.
6621 : : * @param[out] error
6622 : : * Perform verbose error reporting if not NULL. PMDs initialize this
6623 : : * structure in case of error only.
6624 : : * @return
6625 : : * A valid handle in case of success, NULL otherwise and rte_errno is set
6626 : : * to one of the error codes defined:
6627 : : * - (-ENODEV) if *port_id* invalid.
6628 : : * - (-ENOSYS) if underlying device does not support this functionality.
6629 : : * - (-EIO) if underlying device is removed.
6630 : : * - (-EINVAL) if *actions* list invalid.
6631 : : * - (-ENOTSUP) if *action* list element valid but unsupported.
6632 : : */
6633 : : __rte_experimental
6634 : : struct rte_flow_action_list_handle *
6635 : : rte_flow_action_list_handle_create(uint16_t port_id,
6636 : : const
6637 : : struct rte_flow_indir_action_conf *conf,
6638 : : const struct rte_flow_action *actions,
6639 : : struct rte_flow_error *error);
6640 : :
6641 : : /**
6642 : : * @warning
6643 : : * @b EXPERIMENTAL: this API may change without prior notice.
6644 : : *
6645 : : * Async function call to create an indirect flow action object
6646 : : * from flow actions list.
6647 : : * The object is identified by a unique handle.
6648 : : * The handle has single state and configuration
6649 : : * across all the flow rules using it.
6650 : : *
6651 : : * @param[in] port_id
6652 : : * The port identifier of the Ethernet device.
6653 : : * @param[in] queue_id
6654 : : * Flow queue which is used to update the rule.
6655 : : * @param[in] attr
6656 : : * Indirect action update operation attributes.
6657 : : * @param[in] conf
6658 : : * Action configuration for the indirect action list creation.
6659 : : * @param[in] actions
6660 : : * Specific configuration of the indirect action list.
6661 : : * @param[in] user_data
6662 : : * The user data that will be returned on async completion event.
6663 : : * @param[out] error
6664 : : * Perform verbose error reporting if not NULL. PMDs initialize this
6665 : : * structure in case of error only.
6666 : : * @return
6667 : : * A valid handle in case of success, NULL otherwise and rte_errno is set
6668 : : * to one of the error codes defined:
6669 : : * - (-ENODEV) if *port_id* invalid.
6670 : : * - (-ENOSYS) if underlying device does not support this functionality.
6671 : : * - (-EIO) if underlying device is removed.
6672 : : * - (-EINVAL) if *actions* list invalid.
6673 : : * - (-ENOTSUP) if *action* list element valid but unsupported.
6674 : : */
6675 : : __rte_experimental
6676 : : struct rte_flow_action_list_handle *
6677 : : rte_flow_async_action_list_handle_create(uint16_t port_id, uint32_t queue_id,
6678 : : const struct rte_flow_op_attr *attr,
6679 : : const struct rte_flow_indir_action_conf *conf,
6680 : : const struct rte_flow_action *actions,
6681 : : void *user_data,
6682 : : struct rte_flow_error *error);
6683 : :
6684 : : /**
6685 : : * @warning
6686 : : * @b EXPERIMENTAL: this API may change without prior notice.
6687 : : *
6688 : : * Destroy indirect actions list by handle.
6689 : : *
6690 : : * @param[in] port_id
6691 : : * The port identifier of the Ethernet device.
6692 : : * @param[in] handle
6693 : : * Handle for the indirect actions list to be destroyed.
6694 : : * @param[out] error
6695 : : * Perform verbose error reporting if not NULL. PMDs initialize this
6696 : : * structure in case of error only.
6697 : : * @return
6698 : : * - (0) if success.
6699 : : * - (-ENODEV) if *port_id* invalid.
6700 : : * - (-ENOSYS) if underlying device does not support this functionality.
6701 : : * - (-EIO) if underlying device is removed.
6702 : : * - (-ENOENT) if actions list pointed by *action* handle was not found.
6703 : : * - (-EBUSY) if actions list pointed by *action* handle still used
6704 : : */
6705 : : __rte_experimental
6706 : : int
6707 : : rte_flow_action_list_handle_destroy(uint16_t port_id,
6708 : : struct rte_flow_action_list_handle *handle,
6709 : : struct rte_flow_error *error);
6710 : :
6711 : : /**
6712 : : * @warning
6713 : : * @b EXPERIMENTAL: this API may change without prior notice.
6714 : : *
6715 : : * Enqueue indirect action list destruction operation.
6716 : : * The destroy queue must be the same
6717 : : * as the queue on which the action was created.
6718 : : *
6719 : : * @param[in] port_id
6720 : : * Port identifier of Ethernet device.
6721 : : * @param[in] queue_id
6722 : : * Flow queue which is used to destroy the rule.
6723 : : * @param[in] op_attr
6724 : : * Indirect action destruction operation attributes.
6725 : : * @param[in] handle
6726 : : * Handle for the indirect action object to be destroyed.
6727 : : * @param[in] user_data
6728 : : * The user data that will be returned on the completion events.
6729 : : * @param[out] error
6730 : : * Perform verbose error reporting if not NULL.
6731 : : * PMDs initialize this structure in case of error only.
6732 : : *
6733 : : * @return
6734 : : * - (0) if success.
6735 : : * - (-ENODEV) if *port_id* invalid.
6736 : : * - (-ENOSYS) if underlying device does not support this functionality.
6737 : : * - (-EIO) if underlying device is removed.
6738 : : * - (-ENOENT) if actions list pointed by *action* handle was not found.
6739 : : * - (-EBUSY) if actions list pointed by *action* handle still used
6740 : : */
6741 : : __rte_experimental
6742 : : int
6743 : : rte_flow_async_action_list_handle_destroy
6744 : : (uint16_t port_id, uint32_t queue_id,
6745 : : const struct rte_flow_op_attr *op_attr,
6746 : : struct rte_flow_action_list_handle *handle,
6747 : : void *user_data, struct rte_flow_error *error);
6748 : :
6749 : : /**
6750 : : * @warning
6751 : : * @b EXPERIMENTAL: this API may change without prior notice.
6752 : : *
6753 : : * Query and/or update indirect flow actions list.
6754 : : * If both query and update not NULL, the function atomically
6755 : : * queries and updates indirect action. Query and update are carried in order
6756 : : * specified in the mode parameter.
6757 : : * If ether query or update is NULL, the function executes
6758 : : * complementing operation.
6759 : : *
6760 : : * @param port_id
6761 : : * Port identifier of Ethernet device.
6762 : : * @param handle
6763 : : * Handle for the indirect actions list object to be updated.
6764 : : * @param update
6765 : : * If the action list handle was created from n actions A1 / A2 ... An / END
6766 : : * non-NULL update parameter is an array [U1, U2, ... Un] where Ui points to
6767 : : * Ai update context or NULL if Ai should not be updated.
6768 : : * @param query
6769 : : * If the action list handle was created from n actions A1 / A2 ... An / END
6770 : : * non-NULL query parameter is an array [Q1, Q2, ... Qn] where Qi points to
6771 : : * Ai query context or NULL if Ai should not be queried.
6772 : : * @param mode
6773 : : * Operational mode.
6774 : : * @param error
6775 : : * Perform verbose error reporting if not NULL.
6776 : : * PMDs initialize this structure in case of error only.
6777 : : *
6778 : : * @return
6779 : : * - (0) if success.
6780 : : * - (-ENODEV) if *port_id* invalid.
6781 : : * - (-ENOTSUP) if underlying device does not support this functionality.
6782 : : * - (-EINVAL) if *handle* or *mode* invalid or
6783 : : * both *query* and *update* are NULL.
6784 : : */
6785 : : __rte_experimental
6786 : : int
6787 : : rte_flow_action_list_handle_query_update(uint16_t port_id,
6788 : : const struct rte_flow_action_list_handle *handle,
6789 : : const void **update, void **query,
6790 : : enum rte_flow_query_update_mode mode,
6791 : : struct rte_flow_error *error);
6792 : :
6793 : : /**
6794 : : * @warning
6795 : : * @b EXPERIMENTAL: this API may change without prior notice.
6796 : : *
6797 : : * Enqueue async indirect flow actions list query and/or update
6798 : : * If both query and update not NULL, the function atomically
6799 : : * queries and updates indirect action. Query and update are carried in order
6800 : : * specified in the mode parameter.
6801 : : * If ether query or update is NULL, the function executes
6802 : : * complementing operation.
6803 : : *
6804 : : * @param port_id
6805 : : * Port identifier of Ethernet device.
6806 : : * @param queue_id
6807 : : * Flow queue which is used to update the rule.
6808 : : * @param attr
6809 : : * Indirect action update operation attributes.
6810 : : * @param handle
6811 : : * Handle for the indirect actions list object to be updated.
6812 : : * @param update
6813 : : * If the action list handle was created from n actions A1 / A2 ... An / END
6814 : : * non-NULL update parameter is an array [U1, U2, ... Un] where Ui points to
6815 : : * Ai update context or NULL if Ai should not be updated.
6816 : : * @param query
6817 : : * If the action list handle was created from n actions A1 / A2 ... An / END
6818 : : * non-NULL query parameter is an array [Q1, Q2, ... Qn] where Qi points to
6819 : : * Ai query context or NULL if Ai should not be queried.
6820 : : * Query result returned on async completion event.
6821 : : * @param mode
6822 : : * Operational mode.
6823 : : * @param user_data
6824 : : * The user data that will be returned on async completion event.
6825 : : * @param error
6826 : : * Perform verbose error reporting if not NULL.
6827 : : * PMDs initialize this structure in case of error only.
6828 : : *
6829 : : * @return
6830 : : * - (0) if success.
6831 : : * - (-ENODEV) if *port_id* invalid.
6832 : : * - (-ENOTSUP) if underlying device does not support this functionality.
6833 : : * - (-EINVAL) if *handle* or *mode* invalid or
6834 : : * both *update* and *query* are NULL.
6835 : : */
6836 : : __rte_experimental
6837 : : int
6838 : : rte_flow_async_action_list_handle_query_update(uint16_t port_id, uint32_t queue_id,
6839 : : const struct rte_flow_op_attr *attr,
6840 : : const struct rte_flow_action_list_handle *handle,
6841 : : const void **update, void **query,
6842 : : enum rte_flow_query_update_mode mode,
6843 : : void *user_data,
6844 : : struct rte_flow_error *error);
6845 : :
6846 : : /**
6847 : : * @warning
6848 : : * @b EXPERIMENTAL: this API may change without prior notice.
6849 : : *
6850 : : * Calculate the hash for a given pattern in a given table as
6851 : : * calculated by the HW.
6852 : : *
6853 : : * @param port_id
6854 : : * Port identifier of Ethernet device.
6855 : : * @param table
6856 : : * The table the SW wishes to simulate.
6857 : : * @param pattern
6858 : : * The values to be used in the hash calculation.
6859 : : * @param pattern_template_index
6860 : : * The pattern index in the table to be used for the calculation.
6861 : : * @param hash
6862 : : * Used to return the calculated hash.
6863 : : * @param error
6864 : : * Perform verbose error reporting if not NULL.
6865 : : * PMDs initialize this structure in case of error only.
6866 : : *
6867 : : * @return
6868 : : * - (0) if success.
6869 : : * - (-ENODEV) if *port_id* invalid.
6870 : : * - (-ENOTSUP) if underlying device does not support this functionality.
6871 : : */
6872 : : __rte_experimental
6873 : : int
6874 : : rte_flow_calc_table_hash(uint16_t port_id, const struct rte_flow_template_table *table,
6875 : : const struct rte_flow_item pattern[], uint8_t pattern_template_index,
6876 : : uint32_t *hash, struct rte_flow_error *error);
6877 : :
6878 : : /**
6879 : : * @warning
6880 : : * @b EXPERIMENTAL: this API may change without prior notice.
6881 : : *
6882 : : * Destination field type for the hash calculation, when encap action is used.
6883 : : * The encap field implies the size, meaning XXX_SRC_PORT hash len is 2 bytes,
6884 : : * while XXX_NVGRE_FLOW_ID hash len is 1 byte.
6885 : : *
6886 : : * @see function rte_flow_calc_encap_hash
6887 : : */
6888 : : enum rte_flow_encap_hash_field {
6889 : : /** Calculate hash placed in UDP source port field. */
6890 : : RTE_FLOW_ENCAP_HASH_FIELD_SRC_PORT,
6891 : : /** Calculate hash placed in NVGRE flow ID field. */
6892 : : RTE_FLOW_ENCAP_HASH_FIELD_NVGRE_FLOW_ID,
6893 : : };
6894 : :
6895 : : /**
6896 : : * @warning
6897 : : * @b EXPERIMENTAL: this API may change without prior notice.
6898 : : *
6899 : : * Simulate HW hash calculation that is done when an encap action is being used.
6900 : : * This hash can be stored in tunnel outer header to improve packet distribution.
6901 : : *
6902 : : * @param[in] port_id
6903 : : * Port identifier of Ethernet device.
6904 : : * @param[in] pattern
6905 : : * The values to be used in the hash calculation.
6906 : : * @param[in] dest_field
6907 : : * Type of destination field for hash calculation.
6908 : : * @param[in] hash_len
6909 : : * The length of the hash pointer in bytes. Should be according to dest_field.
6910 : : * @param[out] hash
6911 : : * Used to return the calculated hash. It will be written in network order,
6912 : : * so hash[0] is the MSB.
6913 : : * The number of bytes is based on the destination field type.
6914 : : * @param[out] error
6915 : : * Perform verbose error reporting if not NULL.
6916 : : * PMDs initialize this structure in case of error only.
6917 : : *
6918 : : * @return
6919 : : * - (0) if success.
6920 : : * - (-ENODEV) if *port_id* invalid.
6921 : : * - (-ENOTSUP) if underlying device does not support this functionality.
6922 : : * - (-EINVAL) if *pattern* doesn't hold enough information to calculate the hash
6923 : : * or the dest is not supported.
6924 : : */
6925 : : __rte_experimental
6926 : : int
6927 : : rte_flow_calc_encap_hash(uint16_t port_id, const struct rte_flow_item pattern[],
6928 : : enum rte_flow_encap_hash_field dest_field, uint8_t hash_len,
6929 : : uint8_t *hash, struct rte_flow_error *error);
6930 : :
6931 : : /**
6932 : : * @warning
6933 : : * @b EXPERIMENTAL: this API may change without prior notice.
6934 : : *
6935 : : * Update template table for new flow rules capacity.
6936 : : *
6937 : : * @param port_id
6938 : : * Port identifier of Ethernet device.
6939 : : * @param table
6940 : : * Template table to modify.
6941 : : * @param nb_rules
6942 : : * New flow rules capacity.
6943 : : * @param error
6944 : : * Perform verbose error reporting if not NULL.
6945 : : * PMDs initialize this structure in case of error only.
6946 : : *
6947 : : * @return
6948 : : * - (0) if success.
6949 : : * - (-ENODEV) if *port_id* invalid.
6950 : : * - (-ENOTSUP) if underlying device does not support this functionality.
6951 : : * - (-EINVAL) if *table* is not resizable or
6952 : : * *table* resize to *nb_rules* is not supported or
6953 : : * unrecoverable *table* error.
6954 : : */
6955 : : __rte_experimental
6956 : : int
6957 : : rte_flow_template_table_resize(uint16_t port_id,
6958 : : struct rte_flow_template_table *table,
6959 : : uint32_t nb_rules,
6960 : : struct rte_flow_error *error);
6961 : : /**
6962 : : * @warning
6963 : : * @b EXPERIMENTAL: this API may change without prior notice.
6964 : : *
6965 : : * Update *rule* for the new *table* configuration after table resize.
6966 : : * Must be called for each *rule* created before *table* resize.
6967 : : * If called for *rule* created after *table* resize returns success.
6968 : : *
6969 : : * @param port_id
6970 : : * Port identifier of Ethernet device.
6971 : : * @param queue
6972 : : * Flow queue for async operation.
6973 : : * @param attr
6974 : : * Async operation attributes.
6975 : : * @param rule
6976 : : * Flow rule to update.
6977 : : * @param user_data
6978 : : * The user data that will be returned on async completion event.
6979 : : * @param error
6980 : : * Perform verbose error reporting if not NULL.
6981 : : * PMDs initialize this structure in case of error only.
6982 : : *
6983 : : * @return
6984 : : * - (0) if success.
6985 : : * - (-ENODEV) if *port_id* invalid.
6986 : : * - (-ENOTSUP) if underlying device does not support this functionality.
6987 : : * - (-EINVAL) if *table* was not resized.
6988 : : * If *rule* cannot be updated after *table* resize,
6989 : : * unrecoverable *table* error.
6990 : : */
6991 : : __rte_experimental
6992 : : int
6993 : : rte_flow_async_update_resized(uint16_t port_id, uint32_t queue,
6994 : : const struct rte_flow_op_attr *attr,
6995 : : struct rte_flow *rule, void *user_data,
6996 : : struct rte_flow_error *error);
6997 : :
6998 : : /**
6999 : : * @warning
7000 : : * @b EXPERIMENTAL: this API may change without prior notice.
7001 : : *
7002 : : * Resume normal operational mode after table was resized and
7003 : : * table rules were updated for the new table configuration.
7004 : : *
7005 : : * @param port_id
7006 : : * Port identifier of Ethernet device.
7007 : : * @param table
7008 : : * Template table that undergoing resize operation.
7009 : : * @param error
7010 : : * Perform verbose error reporting if not NULL.
7011 : : * PMDs initialize this structure in case of error only.
7012 : : *
7013 : : * @return
7014 : : * - (0) if success.
7015 : : * - (-ENODEV) if *port_id* invalid.
7016 : : * - (-ENOTSUP) if underlying device does not support this functionality.
7017 : : * - (-EBUSY) if not all *table* rules were updated.
7018 : : * - (-EINVAL) if *table* cannot complete table resize,
7019 : : * unrecoverable error.
7020 : : */
7021 : : __rte_experimental
7022 : : int
7023 : : rte_flow_template_table_resize_complete(uint16_t port_id,
7024 : : struct rte_flow_template_table *table,
7025 : : struct rte_flow_error *error);
7026 : :
7027 : : #ifdef __cplusplus
7028 : : }
7029 : : #endif
7030 : :
7031 : : #endif /* RTE_FLOW_H_ */
|