DPDK  21.08.0
rte_flow.h
Go to the documentation of this file.
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 
17 #include <stddef.h>
18 #include <stdint.h>
19 
20 #include <rte_arp.h>
21 #include <rte_common.h>
22 #include <rte_ether.h>
23 #include <rte_icmp.h>
24 #include <rte_ip.h>
25 #include <rte_sctp.h>
26 #include <rte_tcp.h>
27 #include <rte_udp.h>
28 #include <rte_vxlan.h>
29 #include <rte_byteorder.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.h>
35 #include <rte_mbuf_dyn.h>
36 #include <rte_meter.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
79 struct rte_flow_attr {
80  uint32_t group;
81  uint32_t priority;
82  uint32_t ingress:1;
83  uint32_t egress:1;
102  uint32_t transfer:1;
103  uint32_t reserved:29;
104 };
105 
132 
142 
152 
160 
170 
180 
190 
200 
207 
214 
221 
228 
235 
242 
249 
256 
263 
270 
277 
284 
291 
298 
310 
319 
328 
337 
344 
351 
358 
365 
372 
379 
386 
393 
400 
408 
416 
423 
432 
445 
454 
463 
472 
481 
488 
495 
502 
508 
517 
526 
533 
542 
549 
556 
567 
576 };
577 
585  struct rte_higig2_hdr hdr;
586 };
587 
589 #ifndef __cplusplus
591  .hdr = {
592  .ppt1 = {
593  .classification = 0xffff,
594  .vid = 0xfff,
595  },
596  },
597 };
598 #endif
599 
612  uint32_t num;
613 };
614 
616 #ifndef __cplusplus
618  .num = 0x00000000,
619 };
620 #endif
621 
641  uint32_t id;
642 };
643 
645 #ifndef __cplusplus
647  .id = 0x00000000,
648 };
649 #endif
650 
672  uint32_t index;
673 };
674 
676 #ifndef __cplusplus
678  .index = 0x00000000,
679 };
680 #endif
681 
698  uint32_t id;
699 };
700 
702 #ifndef __cplusplus
704  .id = 0xffffffff,
705 };
706 #endif
707 
727  uint32_t relative:1;
728  uint32_t search:1;
729  uint32_t reserved:30;
730  int32_t offset;
731  uint16_t limit;
732  uint16_t length;
733  const uint8_t *pattern;
734 };
735 
737 #ifndef __cplusplus
739  .relative = 1,
740  .search = 1,
741  .reserved = 0x3fffffff,
742  .offset = 0xffffffff,
743  .limit = 0xffff,
744  .length = 0xffff,
745  .pattern = NULL,
746 };
747 #endif
748 
768  union {
769  struct {
770  /*
771  * These fields are retained for compatibility.
772  * Please switch to the new header field below.
773  */
774  struct rte_ether_addr dst;
775  struct rte_ether_addr src;
777  };
778  struct rte_ether_hdr hdr;
779  };
780  uint32_t has_vlan:1;
781  uint32_t reserved:31;
782 };
783 
785 #ifndef __cplusplus
787  .hdr.d_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
788  .hdr.s_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
789  .hdr.ether_type = RTE_BE16(0x0000),
790 };
791 #endif
792 
810  union {
811  struct {
812  /*
813  * These fields are retained for compatibility.
814  * Please switch to the new header field below.
815  */
818  };
819  struct rte_vlan_hdr hdr;
820  };
821  uint32_t has_more_vlan:1;
823  uint32_t reserved:31;
824 };
825 
827 #ifndef __cplusplus
829  .hdr.vlan_tci = RTE_BE16(0x0fff),
830  .hdr.eth_proto = RTE_BE16(0x0000),
831 };
832 #endif
833 
842  struct rte_ipv4_hdr hdr;
843 };
844 
846 #ifndef __cplusplus
848  .hdr = {
849  .src_addr = RTE_BE32(0xffffffff),
850  .dst_addr = RTE_BE32(0xffffffff),
851  },
852 };
853 #endif
854 
863  struct rte_ipv6_hdr hdr;
864  uint32_t has_hop_ext:1;
866  uint32_t has_route_ext:1;
868  uint32_t has_frag_ext:1;
870  uint32_t has_auth_ext:1;
872  uint32_t has_esp_ext:1;
874  uint32_t has_dest_ext:1;
876  uint32_t has_mobil_ext:1;
878  uint32_t has_hip_ext:1;
880  uint32_t has_shim6_ext:1;
882  uint32_t reserved:23;
884 };
885 
887 #ifndef __cplusplus
889  .hdr = {
890  .src_addr =
891  "\xff\xff\xff\xff\xff\xff\xff\xff"
892  "\xff\xff\xff\xff\xff\xff\xff\xff",
893  .dst_addr =
894  "\xff\xff\xff\xff\xff\xff\xff\xff"
895  "\xff\xff\xff\xff\xff\xff\xff\xff",
896  },
897 };
898 #endif
899 
906  struct rte_icmp_hdr hdr;
907 };
908 
910 #ifndef __cplusplus
912  .hdr = {
913  .icmp_type = 0xff,
914  .icmp_code = 0xff,
915  },
916 };
917 #endif
918 
925  struct rte_udp_hdr hdr;
926 };
927 
929 #ifndef __cplusplus
931  .hdr = {
932  .src_port = RTE_BE16(0xffff),
933  .dst_port = RTE_BE16(0xffff),
934  },
935 };
936 #endif
937 
944  struct rte_tcp_hdr hdr;
945 };
946 
948 #ifndef __cplusplus
950  .hdr = {
951  .src_port = RTE_BE16(0xffff),
952  .dst_port = RTE_BE16(0xffff),
953  },
954 };
955 #endif
956 
963  struct rte_sctp_hdr hdr;
964 };
965 
967 #ifndef __cplusplus
969  .hdr = {
970  .src_port = RTE_BE16(0xffff),
971  .dst_port = RTE_BE16(0xffff),
972  },
973 };
974 #endif
975 
983  union {
984  struct {
985  /*
986  * These fields are retained for compatibility.
987  * Please switch to the new header field below.
988  */
989  uint8_t flags;
990  uint8_t rsvd0[3];
991  uint8_t vni[3];
992  uint8_t rsvd1;
993  };
994  struct rte_vxlan_hdr hdr;
995  };
996 };
997 
999 #ifndef __cplusplus
1001  .hdr.vx_vni = RTE_BE32(0xffffff00), /* (0xffffff << 8) */
1002 };
1003 #endif
1004 
1021  uint8_t in_ecid_e;
1022  uint8_t ecid_e;
1024 };
1025 
1027 #ifndef __cplusplus
1029  .rsvd_grp_ecid_b = RTE_BE16(0x3fff),
1030 };
1031 #endif
1032 
1047  uint8_t tni[3];
1048  uint8_t flow_id;
1049 };
1050 
1052 #ifndef __cplusplus
1054  .tni = "\xff\xff\xff",
1055 };
1056 #endif
1057 
1067  uint8_t label_tc_s[3];
1068  uint8_t ttl;
1069 };
1070 
1072 #ifndef __cplusplus
1074  .label_tc_s = "\xff\xff\xf0",
1075 };
1076 #endif
1077 
1090 };
1091 
1093 #ifndef __cplusplus
1095  .protocol = RTE_BE16(0xffff),
1096 };
1097 #endif
1098 
1117  uint32_t thresh;
1118 };
1119 
1121 #ifndef __cplusplus
1123  .thresh = 0xffffffff,
1124 };
1125 #endif
1126 
1140  uint8_t msg_type;
1143 };
1144 
1146 #ifndef __cplusplus
1148  .teid = RTE_BE32(0xffffffff),
1149 };
1150 #endif
1151 
1158  struct rte_esp_hdr hdr;
1159 };
1160 
1162 #ifndef __cplusplus
1164  .hdr = {
1165  .spi = RTE_BE32(0xffffffff),
1166  },
1167 };
1168 #endif
1169 
1182  uint8_t vni[3];
1183  uint8_t rsvd1;
1184 };
1185 
1187 #ifndef __cplusplus
1189  .vni = "\xff\xff\xff",
1190 };
1191 #endif
1192 
1199  uint8_t flags;
1200  uint8_t rsvd0[2];
1201  uint8_t protocol;
1202  uint8_t vni[3];
1203  uint8_t rsvd1;
1204 };
1205 
1207 #ifndef __cplusplus
1209  .vni = "\xff\xff\xff",
1210 };
1211 #endif
1212 
1221  uint8_t hln;
1222  uint8_t pln;
1224  struct rte_ether_addr sha;
1226  struct rte_ether_addr tha;
1228 };
1229 
1231 #ifndef __cplusplus
1232 static const struct rte_flow_item_arp_eth_ipv4
1234  .sha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1235  .spa = RTE_BE32(0xffffffff),
1236  .tha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1237  .tpa = RTE_BE32(0xffffffff),
1238 };
1239 #endif
1240 
1252  uint8_t next_hdr;
1253 };
1254 
1256 #ifndef __cplusplus
1257 static const
1259  .next_hdr = 0xff,
1260 };
1261 #endif
1262 
1274  struct rte_ipv6_fragment_ext hdr;
1275 };
1276 
1283  uint8_t type;
1284  uint8_t code;
1285  uint16_t checksum;
1286 };
1287 
1289 #ifndef __cplusplus
1291  .type = 0xff,
1292  .code = 0xff,
1293 };
1294 #endif
1295 
1302  uint8_t type;
1303  uint8_t code;
1306  uint8_t target_addr[16];
1307 };
1308 
1310 #ifndef __cplusplus
1311 static const
1313  .target_addr =
1314  "\xff\xff\xff\xff\xff\xff\xff\xff"
1315  "\xff\xff\xff\xff\xff\xff\xff\xff",
1316 };
1317 #endif
1318 
1325  uint8_t type;
1326  uint8_t code;
1333  uint8_t target_addr[16];
1334 };
1335 
1337 #ifndef __cplusplus
1338 static const
1340  .target_addr =
1341  "\xff\xff\xff\xff\xff\xff\xff\xff"
1342  "\xff\xff\xff\xff\xff\xff\xff\xff",
1343 };
1344 #endif
1345 
1358  uint8_t type;
1359  uint8_t length;
1360 };
1361 
1363 #ifndef __cplusplus
1364 static const struct rte_flow_item_icmp6_nd_opt
1366  .type = 0xff,
1367 };
1368 #endif
1369 
1382  uint8_t type;
1383  uint8_t length;
1384  struct rte_ether_addr sla;
1385 };
1386 
1388 #ifndef __cplusplus
1389 static const struct rte_flow_item_icmp6_nd_opt_sla_eth
1391  .sla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1392 };
1393 #endif
1394 
1407  uint8_t type;
1408  uint8_t length;
1409  struct rte_ether_addr tla;
1410 };
1411 
1413 #ifndef __cplusplus
1414 static const struct rte_flow_item_icmp6_nd_opt_tla_eth
1416  .tla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1417 };
1418 #endif
1419 
1431  uint32_t data;
1432 };
1433 
1435 #ifndef __cplusplus
1437  .data = UINT32_MAX,
1438 };
1439 #endif
1440 
1447  uint8_t pdu_type;
1448  uint8_t qfi;
1449 };
1450 
1452 #ifndef __cplusplus
1453 static const struct rte_flow_item_gtp_psc
1455  .qfi = 0xff,
1456 };
1457 #endif
1458 
1468  uint8_t version_type;
1469  uint8_t code;
1472 };
1473 
1488 };
1489 
1491 #ifndef __cplusplus
1492 static const struct rte_flow_item_pppoe_proto_id
1494  .proto_id = RTE_BE16(0xffff),
1495 };
1496 #endif
1497 
1507  uint32_t data;
1508  uint8_t index;
1509 };
1510 
1512 #ifndef __cplusplus
1514  .data = 0xffffffff,
1515  .index = 0xff,
1516 };
1517 #endif
1518 
1526 };
1527 
1529 #ifndef __cplusplus
1531  .session_id = RTE_BE32(UINT32_MAX),
1532 };
1533 #endif
1534 
1535 
1555  uint32_t id;
1556 };
1557 
1559 #ifndef __cplusplus
1561  .id = 0xffffffff,
1562 };
1563 #endif
1564 
1575  uint32_t version:2;
1576  uint32_t oam_pkt:1;
1577  uint32_t reserved:1;
1578  uint32_t ttl:6;
1579  uint32_t length:6;
1580  uint32_t reserved1:4;
1581  uint32_t mdtype:4;
1582  uint32_t next_proto:8;
1583  uint32_t spi:24;
1584  uint32_t sindex:8;
1585 };
1586 
1588 #ifndef __cplusplus
1590  .mdtype = 0xf,
1591  .next_proto = 0xff,
1592  .spi = 0xffffff,
1593  .sindex = 0xff,
1594 };
1595 #endif
1596 
1607  uint32_t type:8;
1608  uint32_t max_resp_time:8;
1609  uint32_t checksum:16;
1610  uint32_t group_addr;
1611 };
1612 
1614 #ifndef __cplusplus
1616  .group_addr = 0xffffffff,
1617 };
1618 #endif
1619 
1630  uint32_t next_hdr:8;
1631  uint32_t payload_len:8;
1632  uint32_t reserved:16;
1633  uint32_t spi;
1634  uint32_t seq_num;
1635 };
1636 
1638 #ifndef __cplusplus
1640  .spi = 0xffffffff,
1641 };
1642 #endif
1643 
1653  uint8_t s_field;
1654  uint8_t msg_type;
1655  rte_be16_t msg_len;
1656  rte_be64_t seid;
1657 };
1658 
1660 #ifndef __cplusplus
1662  .s_field = 0x01,
1663  .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
1664 };
1665 #endif
1666 
1676  struct rte_ecpri_combined_msg_hdr hdr;
1677 };
1678 
1680 #ifndef __cplusplus
1682  .hdr = {
1683  .common = {
1684  .u32 = 0x0,
1685  },
1686  },
1687 };
1688 #endif
1689 
1696  rte_be16_t option_class;
1697  uint8_t option_type;
1698  uint8_t option_len;
1699  uint32_t *data;
1700 };
1701 
1703 #ifndef __cplusplus
1704 static const struct rte_flow_item_geneve_opt
1706  .option_type = 0xff,
1707 };
1708 #endif
1709 
1722  uint32_t level;
1723  RTE_STD_C11
1724  union {
1725  __extension__
1726  struct {
1728  uint64_t packet_ok:1;
1730  uint64_t l2_ok:1;
1732  uint64_t l3_ok:1;
1734  uint64_t l4_ok:1;
1736  uint64_t l2_crc_ok:1;
1738  uint64_t ipv4_csum_ok:1;
1740  uint64_t l4_csum_ok:1;
1742  uint64_t l3_len_ok:1;
1743  uint64_t reserved:56;
1744  };
1745  uint64_t value;
1746  };
1747 };
1748 
1749 #ifndef __cplusplus
1750 static const struct rte_flow_item_integrity
1751 rte_flow_item_integrity_mask = {
1752  .level = 0,
1753  .value = 0,
1754 };
1755 #endif
1756 
1760 #define RTE_FLOW_CONNTRACK_PKT_STATE_VALID RTE_BIT32(0)
1761 
1764 #define RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED RTE_BIT32(1)
1765 
1769 #define RTE_FLOW_CONNTRACK_PKT_STATE_INVALID RTE_BIT32(2)
1770 
1774 #define RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED RTE_BIT32(3)
1775 
1779 #define RTE_FLOW_CONNTRACK_PKT_STATE_BAD RTE_BIT32(4)
1780 
1792  uint32_t flags;
1793 };
1794 
1796 #ifndef __cplusplus
1798  .flags = 0xffffffff,
1799 };
1800 #endif
1801 
1837  const void *spec;
1838  const void *last;
1839  const void *mask;
1840 };
1841 
1876 
1884 
1892 
1901 
1909 
1917 
1924 
1933 
1944 
1953 
1961 
1969 
1977 
1984 
1992 
2000 
2008 
2016 
2024 
2032 
2041 
2050 
2058 
2066 
2074 
2082 
2090 
2098 
2106 
2115 
2123 
2132 
2139 
2146 
2156 
2166 
2176 
2186 
2197 
2208 
2219 
2226 
2233 
2243 
2253 
2267 
2281 
2295 
2309 
2319 
2326 
2336 
2346 
2357 
2365 
2376 
2387 
2395 
2404 
2412 };
2413 
2425  uint32_t id;
2426 };
2427 
2441  uint32_t group;
2442 };
2443 
2450  uint16_t index;
2451 };
2452 
2467  uint32_t timeout:24;
2468  uint32_t reserved:8;
2469  void *context;
2471 };
2472 
2480  uint32_t reserved:6;
2481  uint32_t aged:1;
2484  uint32_t sec_since_last_hit:24;
2485 };
2486 
2517  uint32_t shared:1;
2518  uint32_t reserved:31;
2519  uint32_t id;
2520 };
2521 
2528  uint32_t reset:1;
2529  uint32_t hits_set:1;
2530  uint32_t bytes_set:1;
2531  uint32_t reserved:29;
2532  uint64_t hits;
2533  uint64_t bytes;
2534 };
2535 
2540  RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
2549  RTE_ETH_HASH_FUNCTION_MAX,
2550 };
2551 
2595  uint32_t level;
2596  uint64_t types;
2597  uint32_t key_len;
2598  uint32_t queue_num;
2599  const uint8_t *key;
2600  const uint16_t *queue;
2601 };
2602 
2616  uint32_t original:1;
2617  uint32_t reserved:31;
2618  uint32_t id;
2619 };
2620 
2630  uint32_t original:1;
2631  uint32_t reserved:31;
2632  uint32_t index;
2633 };
2634 
2643  uint32_t original:1;
2644  uint32_t reserved:31;
2645  uint32_t id;
2646 };
2647 
2657  uint32_t mtr_id;
2658 };
2659 
2692 };
2693 
2701  uint8_t mpls_ttl;
2702 };
2703 
2711  uint8_t nw_ttl;
2712 };
2713 
2722 };
2723 
2732 };
2733 
2741  uint8_t vlan_pcp;
2742 };
2743 
2752 };
2753 
2762 };
2763 
2797 };
2798 
2831 };
2832 
2853  uint8_t *data;
2854  uint8_t *preserve;
2855  size_t size;
2856 };
2857 
2874  uint8_t *data;
2875  size_t size;
2876 };
2877 
2890  rte_be32_t ipv4_addr;
2891 };
2892 
2905  uint8_t ipv6_addr[16];
2906 };
2907 
2920  rte_be16_t port;
2921 };
2922 
2929  uint8_t ttl_value;
2930 };
2931 
2938  uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
2939 };
2940 
2951  uint32_t data;
2952  uint32_t mask;
2953  uint8_t index;
2954 };
2955 
2976  uint32_t data;
2977  uint32_t mask;
2978 };
2979 
2988  uint8_t dscp;
2989 };
2990 
3008 struct rte_flow_action_handle;
3009 
3026 };
3027 
3038 };
3039 
3051  uint32_t scale:4;
3053  uint32_t close_initiated:1;
3055  uint32_t last_ack_seen:1;
3060  uint32_t data_unacked:1;
3065  uint32_t sent_end;
3070  uint32_t reply_end;
3072  uint32_t max_win;
3074  uint32_t max_ack;
3075 };
3076 
3089  uint16_t peer_port;
3094  uint32_t is_original_dir:1;
3102  uint32_t enable:1;
3104  uint32_t live_connection:1;
3106  uint32_t selective_ack:1;
3113  uint32_t last_direction:1;
3115  uint32_t liberal_mode:1;
3117  enum rte_flow_conntrack_state state;
3123  struct rte_flow_tcp_dir_param original_dir;
3125  struct rte_flow_tcp_dir_param reply_dir;
3127  uint16_t last_window;
3128  enum rte_flow_conntrack_tcp_last_index last_index;
3130  uint32_t last_seq;
3132  uint32_t last_ack;
3137  uint32_t last_end;
3138 };
3139 
3151  uint32_t direction:1;
3153  uint32_t state:1;
3155  uint32_t reserved:30;
3156 };
3157 
3168  enum rte_color color;
3169 };
3170 
3204 };
3205 
3210  enum rte_flow_field_id field;
3211  RTE_STD_C11
3212  union {
3213  struct {
3215  uint32_t level;
3217  uint32_t offset;
3218  };
3223  uint64_t value;
3224  };
3225 };
3226 
3234 };
3235 
3247  enum rte_flow_modify_op operation;
3250  uint32_t width;
3251 };
3252 
3253 /* Mbuf dynamic field offset for metadata. */
3254 extern int32_t rte_flow_dynf_metadata_offs;
3255 
3256 /* Mbuf dynamic field flag mask for metadata. */
3257 extern uint64_t rte_flow_dynf_metadata_mask;
3258 
3259 /* Mbuf dynamic field pointer for metadata. */
3260 #define RTE_FLOW_DYNF_METADATA(m) \
3261  RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
3262 
3263 /* Mbuf dynamic flags for metadata. */
3264 #define PKT_RX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
3265 #define PKT_TX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
3266 
3267 __rte_experimental
3268 static inline uint32_t
3269 rte_flow_dynf_metadata_get(struct rte_mbuf *m)
3270 {
3271  return *RTE_FLOW_DYNF_METADATA(m);
3272 }
3273 
3274 __rte_experimental
3275 static inline void
3276 rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
3277 {
3278  *RTE_FLOW_DYNF_METADATA(m) = v;
3279 }
3280 
3290  const void *conf;
3291 };
3292 
3299 struct rte_flow;
3300 
3318  uint32_t ratio;
3319  const struct rte_flow_action *actions;
3321 };
3322 
3347 };
3348 
3362  const void *cause;
3363  const char *message;
3364 };
3365 
3376  union {
3377  const struct rte_flow_attr *attr_ro;
3379  };
3380  union {
3381  const struct rte_flow_item *pattern_ro;
3383  };
3384  union {
3385  const struct rte_flow_action *actions_ro;
3387  };
3388 };
3389 
3402 
3414 
3426 
3438 
3451 
3464 
3477 
3491 
3505 
3519 
3533 };
3534 
3554 __rte_experimental
3555 int
3556 rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
3557  FILE *file, struct rte_flow_error *error);
3558 
3565 __rte_experimental
3566 static inline int
3568 {
3569  return !!rte_flow_dynf_metadata_mask;
3570 }
3571 
3582 __rte_experimental
3583 int
3585 
3638 int
3639 rte_flow_validate(uint16_t port_id,
3640  const struct rte_flow_attr *attr,
3641  const struct rte_flow_item pattern[],
3642  const struct rte_flow_action actions[],
3643  struct rte_flow_error *error);
3644 
3665 struct rte_flow *
3666 rte_flow_create(uint16_t port_id,
3667  const struct rte_flow_attr *attr,
3668  const struct rte_flow_item pattern[],
3669  const struct rte_flow_action actions[],
3670  struct rte_flow_error *error);
3671 
3692 int
3693 rte_flow_destroy(uint16_t port_id,
3694  struct rte_flow *flow,
3695  struct rte_flow_error *error);
3696 
3713 int
3714 rte_flow_flush(uint16_t port_id,
3715  struct rte_flow_error *error);
3716 
3741 int
3742 rte_flow_query(uint16_t port_id,
3743  struct rte_flow *flow,
3744  const struct rte_flow_action *action,
3745  void *data,
3746  struct rte_flow_error *error);
3747 
3789 int
3790 rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
3791 
3809 int
3810 rte_flow_error_set(struct rte_flow_error *error,
3811  int code,
3812  enum rte_flow_error_type type,
3813  const void *cause,
3814  const char *message);
3815 
3821  size_t size;
3822  struct rte_flow_attr attr;
3825  uint8_t data[];
3826 };
3827 
3854 __rte_deprecated
3855 size_t
3856 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
3857  const struct rte_flow_attr *attr,
3858  const struct rte_flow_item *items,
3859  const struct rte_flow_action *actions);
3860 
3901 __rte_experimental
3902 int
3904  void *dst,
3905  size_t size,
3906  const void *src,
3907  struct rte_flow_error *error);
3908 
3937 __rte_experimental
3938 int
3939 rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
3940  uint32_t nb_contexts, struct rte_flow_error *error);
3941 
3952  uint32_t ingress:1;
3954  uint32_t egress:1;
3960  uint32_t transfer:1;
3961 };
3962 
3990 __rte_experimental
3991 struct rte_flow_action_handle *
3992 rte_flow_action_handle_create(uint16_t port_id,
3993  const struct rte_flow_indir_action_conf *conf,
3994  const struct rte_flow_action *action,
3995  struct rte_flow_error *error);
3996 
4019 __rte_experimental
4020 int
4021 rte_flow_action_handle_destroy(uint16_t port_id,
4022  struct rte_flow_action_handle *handle,
4023  struct rte_flow_error *error);
4024 
4058 __rte_experimental
4059 int
4060 rte_flow_action_handle_update(uint16_t port_id,
4061  struct rte_flow_action_handle *handle,
4062  const void *update,
4063  struct rte_flow_error *error);
4064 
4090 __rte_experimental
4091 int
4092 rte_flow_action_handle_query(uint16_t port_id,
4093  const struct rte_flow_action_handle *handle,
4094  void *data, struct rte_flow_error *error);
4095 
4096 /* Tunnel has a type and the key information. */
4097 struct rte_flow_tunnel {
4102  enum rte_flow_item_type type;
4103  uint64_t tun_id;
4105  RTE_STD_C11
4106  union {
4107  struct {
4108  rte_be32_t src_addr;
4109  rte_be32_t dst_addr;
4110  } ipv4;
4111  struct {
4112  uint8_t src_addr[16];
4113  uint8_t dst_addr[16];
4114  } ipv6;
4115  };
4116  rte_be16_t tp_src;
4117  rte_be16_t tp_dst;
4118  uint16_t tun_flags;
4120  bool is_ipv6;
4126  uint8_t tos;
4127  uint8_t ttl;
4128  uint32_t label;
4129 };
4130 
4134 #define RTE_FLOW_RESTORE_INFO_TUNNEL (1ULL << 0)
4135 
4139 #define RTE_FLOW_RESTORE_INFO_ENCAPSULATED (1ULL << 1)
4140 
4144 #define RTE_FLOW_RESTORE_INFO_GROUP_ID (1ULL << 2)
4145 
4156  uint64_t flags;
4157  uint32_t group_id;
4158  struct rte_flow_tunnel tunnel;
4159 };
4160 
4184 __rte_experimental
4185 int
4186 rte_flow_tunnel_decap_set(uint16_t port_id,
4187  struct rte_flow_tunnel *tunnel,
4188  struct rte_flow_action **actions,
4189  uint32_t *num_of_actions,
4190  struct rte_flow_error *error);
4191 
4215 __rte_experimental
4216 int
4217 rte_flow_tunnel_match(uint16_t port_id,
4218  struct rte_flow_tunnel *tunnel,
4219  struct rte_flow_item **items,
4220  uint32_t *num_of_items,
4221  struct rte_flow_error *error);
4222 
4239 __rte_experimental
4240 int
4241 rte_flow_get_restore_info(uint16_t port_id,
4242  struct rte_mbuf *m,
4243  struct rte_flow_restore_info *info,
4244  struct rte_flow_error *error);
4245 
4262 __rte_experimental
4263 int
4264 rte_flow_tunnel_action_decap_release(uint16_t port_id,
4265  struct rte_flow_action *actions,
4266  uint32_t num_of_actions,
4267  struct rte_flow_error *error);
4268 
4285 __rte_experimental
4286 int
4287 rte_flow_tunnel_item_release(uint16_t port_id,
4288  struct rte_flow_item *items,
4289  uint32_t num_of_items,
4290  struct rte_flow_error *error);
4291 #ifdef __cplusplus
4292 }
4293 #endif
4294 
4295 #endif /* RTE_FLOW_H_ */
uint32_t reserved
Definition: rte_flow.h:103
static const struct rte_flow_item_icmp6_nd_opt_sla_eth rte_flow_item_icmp6_nd_opt_sla_eth_mask
Definition: rte_flow.h:1390
rte_be32_t u32
Definition: rte_ecpri.h:72
rte_flow_field_id
Definition: rte_flow.h:3174
rte_be16_t c_rsvd0_ver
Definition: rte_flow.h:1088
rte_be16_t ver_opt_len_o_c_rsvd0
Definition: rte_flow.h:1180
__rte_experimental int rte_flow_action_handle_update(uint16_t port_id, struct rte_flow_action_handle *handle, const void *update, struct rte_flow_error *error)
uint32_t reserved
Definition: rte_flow.h:882
int rte_flow_validate(uint16_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
struct rte_flow_action * actions
Definition: rte_flow.h:3386
static const struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask
Definition: rte_flow.h:1339
static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask
Definition: rte_flow.h:888
rte_be16_t epcp_edei_in_ecid_b
Definition: rte_flow.h:1018
__rte_experimental int rte_flow_action_handle_query(uint16_t port_id, const struct rte_flow_action_handle *handle, void *data, struct rte_flow_error *error)
rte_be16_t protocol
Definition: rte_flow.h:1181
static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask
Definition: rte_flow.h:1661
uint32_t has_auth_ext
Definition: rte_flow.h:870
uint32_t num
Definition: rte_flow.h:612
struct rte_flow_attr * attr
Definition: rte_flow.h:3378
uint32_t has_mobil_ext
Definition: rte_flow.h:876
uint32_t sec_since_last_hit
Definition: rte_flow.h:2484
uint32_t rte_be32_t
__rte_experimental int rte_flow_action_handle_destroy(uint16_t port_id, struct rte_flow_action_handle *handle, struct rte_flow_error *error)
uint32_t original
Definition: rte_flow.h:2616
int rte_flow_query(uint16_t port_id, struct rte_flow *flow, const struct rte_flow_action *action, void *data, struct rte_flow_error *error)
uint32_t group
Definition: rte_flow.h:80
struct rte_flow_item * definition
Definition: rte_flow.h:2796
static const struct rte_flow_item_gre rte_flow_item_gre_mask
Definition: rte_flow.h:1094
rte_be16_t msg_len
Definition: rte_flow.h:1141
static const struct rte_flow_item_gtp rte_flow_item_gtp_mask
Definition: rte_flow.h:1147
static const struct rte_flow_item_icmp rte_flow_item_icmp_mask
Definition: rte_flow.h:911
#define RTE_ETHER_ADDR_LEN
Definition: rte_ether.h:26
static const struct rte_flow_item_geneve rte_flow_item_geneve_mask
Definition: rte_flow.h:1188
const struct rte_flow_attr * attr_ro
Definition: rte_flow.h:3377
static const struct rte_flow_item_sctp rte_flow_item_sctp_mask
Definition: rte_flow.h:968
int rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error)
static const struct rte_flow_item_any rte_flow_item_any_mask
Definition: rte_flow.h:617
static const struct rte_flow_item_meta rte_flow_item_meta_mask
Definition: rte_flow.h:1436
static const struct rte_flow_item_esp rte_flow_item_esp_mask
Definition: rte_flow.h:1163
rte_flow_conntrack_state
Definition: rte_flow.h:3013
__rte_experimental int rte_flow_get_restore_info(uint16_t port_id, struct rte_mbuf *m, struct rte_flow_restore_info *info, struct rte_flow_error *error)
struct rte_icmp_hdr hdr
Definition: rte_flow.h:906
__rte_deprecated size_t rte_flow_copy(struct rte_flow_desc *fd, size_t len, const struct rte_flow_attr *attr, const struct rte_flow_item *items, const struct rte_flow_action *actions)
uint8_t v_pt_rsv_flags
Definition: rte_flow.h:1139
struct rte_ether_addr tla
Definition: rte_flow.h:1409
rte_be16_t protocol
Definition: rte_flow.h:1046
uint32_t reserved
Definition: rte_flow.h:729
rte_be32_t spi
Definition: rte_esp.h:24
static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask
Definition: rte_flow.h:1797
static const struct rte_flow_item_geneve_opt rte_flow_item_geneve_opt_mask
Definition: rte_flow.h:1705
static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask
Definition: rte_flow.h:1290
rte_be16_t src_port
Definition: rte_sctp.h:29
struct rte_flow_action * actions
Definition: rte_flow.h:3824
struct rte_ipv4_hdr hdr
Definition: rte_flow.h:842
static const struct rte_flow_item_mark rte_flow_item_mark_mask
Definition: rte_flow.h:1560
uint32_t reserved
Definition: rte_flow.h:2480
rte_be32_t src_addr
Definition: rte_ip.h:49
static const struct rte_flow_item_icmp6_nd_opt rte_flow_item_icmp6_nd_opt_mask
Definition: rte_flow.h:1365
static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask
Definition: rte_flow.h:677
static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask
Definition: rte_flow.h:1000
#define RTE_BIT32(nr)
Definition: rte_bitops.h:34
uint8_t src_addr[16]
Definition: rte_ip.h:438
static const struct rte_flow_item_port_id rte_flow_item_port_id_mask
Definition: rte_flow.h:703
static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask
Definition: rte_flow.h:590
static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask
Definition: rte_flow.h:1053
uint64_t rte_be64_t
const void * mask
Definition: rte_flow.h:1839
struct rte_flow_item * pattern
Definition: rte_flow.h:3382
rte_be16_t type
Definition: rte_flow.h:776
const void * cause
Definition: rte_flow.h:3362
static const struct rte_flow_item_udp rte_flow_item_udp_mask
Definition: rte_flow.h:930
struct rte_esp_hdr hdr
Definition: rte_flow.h:1158
rte_flow_error_type
Definition: rte_flow.h:3329
struct rte_ether_addr d_addr
Definition: rte_ether.h:271
uint32_t has_esp_ext
Definition: rte_flow.h:872
rte_flow_conv_op
Definition: rte_flow.h:3395
rte_be16_t src_port
Definition: rte_udp.h:29
uint32_t has_shim6_ext
Definition: rte_flow.h:880
__rte_experimental int rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow, FILE *file, struct rte_flow_error *error)
uint32_t has_route_ext
Definition: rte_flow.h:866
uint32_t id
Definition: rte_flow.h:641
const uint8_t * pattern
Definition: rte_flow.h:733
uint32_t search
Definition: rte_flow.h:728
rte_be16_t rsvd_grp_ecid_b
Definition: rte_flow.h:1020
static const struct rte_flow_item_raw rte_flow_item_raw_mask
Definition: rte_flow.h:738
uint16_t limit
Definition: rte_flow.h:731
rte_flow_conntrack_tcp_last_index
Definition: rte_flow.h:3031
int rte_flow_flush(uint16_t port_id, struct rte_flow_error *error)
static const struct rte_flow_item_mpls rte_flow_item_mpls_mask
Definition: rte_flow.h:1073
static const struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask
Definition: rte_flow.h:1312
__rte_experimental struct rte_flow_action_handle * rte_flow_action_handle_create(uint16_t port_id, const struct rte_flow_indir_action_conf *conf, const struct rte_flow_action *action, struct rte_flow_error *error)
int rte_flow_error_set(struct rte_flow_error *error, int code, enum rte_flow_error_type type, const void *cause, const char *message)
const void * conf
Definition: rte_flow.h:3290
const char * message
Definition: rte_flow.h:3363
rte_eth_hash_function
Definition: rte_flow.h:2539
uint32_t close_initiated
Definition: rte_flow.h:3053
uint16_t length
Definition: rte_flow.h:732
const void * last
Definition: rte_flow.h:1838
static const struct rte_flow_item_icmp6_nd_opt_tla_eth rte_flow_item_icmp6_nd_opt_tla_eth_mask
Definition: rte_flow.h:1415
rte_be32_t teid
Definition: rte_flow.h:1142
int rte_flow_destroy(uint16_t port_id, struct rte_flow *flow, struct rte_flow_error *error)
uint32_t ingress
Definition: rte_flow.h:82
rte_be16_t tci
Definition: rte_flow.h:816
rte_be32_t vx_vni
Definition: rte_vxlan.h:35
static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask
Definition: rte_flow.h:847
size_t size
Definition: rte_flow.h:3821
rte_be16_t c_k_s_rsvd0_ver
Definition: rte_flow.h:1045
static const struct rte_flow_item_gtp_psc rte_flow_item_gtp_psc_mask
Definition: rte_flow.h:1454
rte_be16_t length
Definition: rte_flow.h:1471
const struct rte_flow_action * actions_ro
Definition: rte_flow.h:3385
uint32_t has_vlan
Definition: rte_flow.h:780
uint32_t has_more_vlan
Definition: rte_flow.h:821
struct rte_flow_item * items
Definition: rte_flow.h:3823
__rte_experimental int rte_flow_get_aged_flows(uint16_t port_id, void **contexts, uint32_t nb_contexts, struct rte_flow_error *error)
rte_flow_action_type
Definition: rte_flow.h:1868
struct rte_ether_addr sla
Definition: rte_flow.h:1384
rte_flow_modify_op
Definition: rte_flow.h:3230
uint32_t has_hop_ext
Definition: rte_flow.h:864
struct rte_flow * rte_flow_create(uint16_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask
Definition: rte_flow.h:1530
rte_color
Definition: rte_meter.h:36
static const struct rte_flow_item_igmp rte_flow_item_igmp_mask
Definition: rte_flow.h:1615
const void * spec
Definition: rte_flow.h:1837
uint8_t label_tc_s[3]
Definition: rte_flow.h:1067
uint8_t version_type
Definition: rte_flow.h:1468
#define RTE_STD_C11
Definition: rte_common.h:42
__rte_experimental int rte_flow_tunnel_decap_set(uint16_t port_id, struct rte_flow_tunnel *tunnel, struct rte_flow_action **actions, uint32_t *num_of_actions, struct rte_flow_error *error)
const uint8_t * key
Definition: rte_flow.h:2599
static const struct rte_flow_item_arp_eth_ipv4 rte_flow_item_arp_eth_ipv4_mask
Definition: rte_flow.h:1233
uint32_t has_hip_ext
Definition: rte_flow.h:878
const struct rte_flow_action * actions
Definition: rte_flow.h:3319
uint32_t sec_since_last_hit_valid
Definition: rte_flow.h:2482
rte_be16_t vlan_tci
Definition: rte_ether.h:290
struct rte_ether_addr sha
Definition: rte_flow.h:1224
static const struct rte_flow_item_eth rte_flow_item_eth_mask
Definition: rte_flow.h:786
rte_be16_t src_port
Definition: rte_tcp.h:29
uint16_t rte_be16_t
__rte_experimental int rte_flow_conv(enum rte_flow_conv_op op, void *dst, size_t size, const void *src, struct rte_flow_error *error)
uint32_t has_frag_ext
Definition: rte_flow.h:868
uint32_t reserved
Definition: rte_flow.h:2617
__rte_experimental int rte_flow_dynf_metadata_register(void)
static const struct rte_flow_item_ah rte_flow_item_ah_mask
Definition: rte_flow.h:1639
static const struct rte_flow_item_tag rte_flow_item_tag_mask
Definition: rte_flow.h:1513
uint32_t priority
Definition: rte_flow.h:81
uint32_t has_dest_ext
Definition: rte_flow.h:874
static const struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask
Definition: rte_flow.h:1258
static const struct rte_flow_item_vf rte_flow_item_vf_mask
Definition: rte_flow.h:646
struct rte_ipv6_hdr hdr
Definition: rte_flow.h:863
static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask
Definition: rte_flow.h:1681
rte_be16_t protocol
Definition: rte_flow.h:1089
uint32_t queue_num
Definition: rte_flow.h:2598
uint8_t tni[3]
Definition: rte_flow.h:1047
struct rte_tcp_hdr hdr
Definition: rte_flow.h:944
static const struct rte_flow_item_pppoe_proto_id rte_flow_item_pppoe_proto_id_mask
Definition: rte_flow.h:1493
uint32_t transfer
Definition: rte_flow.h:102
struct rte_flow_item * definition
Definition: rte_flow.h:2830
static const struct rte_flow_item_vlan rte_flow_item_vlan_mask
Definition: rte_flow.h:828
uint8_t msg_type
Definition: rte_flow.h:1140
uint32_t reserved
Definition: rte_flow.h:823
uint32_t egress
Definition: rte_flow.h:83
static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask
Definition: rte_flow.h:1028
static __rte_experimental int rte_flow_dynf_metadata_avail(void)
Definition: rte_flow.h:3567
__rte_experimental int rte_flow_tunnel_item_release(uint16_t port_id, struct rte_flow_item *items, uint32_t num_of_items, struct rte_flow_error *error)
static const struct rte_flow_item_tcp rte_flow_item_tcp_mask
Definition: rte_flow.h:949
static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask
Definition: rte_flow.h:1122
uint8_t addr_bytes[RTE_ETHER_ADDR_LEN]
Definition: rte_ether.h:61
rte_be16_t inner_type
Definition: rte_flow.h:817
__rte_experimental int rte_flow_tunnel_action_decap_release(uint16_t port_id, struct rte_flow_action *actions, uint32_t num_of_actions, struct rte_flow_error *error)
struct rte_udp_hdr hdr
Definition: rte_flow.h:925
const uint16_t * queue
Definition: rte_flow.h:2600
rte_flow_item_type
Definition: rte_flow.h:122
uint32_t relative
Definition: rte_flow.h:727
int32_t offset
Definition: rte_flow.h:730
rte_be16_t inner_type
Definition: rte_flow.h:1023
__rte_experimental int rte_flow_tunnel_match(uint16_t port_id, struct rte_flow_tunnel *tunnel, struct rte_flow_item **items, uint32_t *num_of_items, struct rte_flow_error *error)
const struct rte_flow_item * pattern_ro
Definition: rte_flow.h:3381
static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask
Definition: rte_flow.h:1208
rte_be16_t session_id
Definition: rte_flow.h:1470
static const struct rte_flow_item_nsh rte_flow_item_nsh_mask
Definition: rte_flow.h:1589
struct rte_sctp_hdr hdr
Definition: rte_flow.h:963
uint32_t reserved
Definition: rte_flow.h:781