DPDK  21.02.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_byteorder.h>
29 #include <rte_esp.h>
30 #include <rte_higig.h>
31 #include <rte_ecpri.h>
32 #include <rte_mbuf.h>
33 #include <rte_mbuf_dyn.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
76 struct rte_flow_attr {
77  uint32_t group;
78  uint32_t priority;
79  uint32_t ingress:1;
80  uint32_t egress:1;
99  uint32_t transfer:1;
100  uint32_t reserved:29;
101 };
102 
129 
139 
149 
157 
167 
177 
187 
197 
204 
211 
218 
225 
232 
239 
246 
253 
260 
267 
274 
281 
288 
295 
307 
316 
325 
334 
341 
348 
355 
362 
369 
376 
383 
390 
397 
405 
413 
420 
429 
442 
451 
460 
469 
478 
485 
492 
499 
505 
514 
523 
530 
539 
546 
553 };
554 
562  struct rte_higig2_hdr hdr;
563 };
564 
566 #ifndef __cplusplus
568  .hdr = {
569  .ppt1 = {
570  .classification = 0xffff,
571  .vid = 0xfff,
572  },
573  },
574 };
575 #endif
576 
589  uint32_t num;
590 };
591 
593 #ifndef __cplusplus
595  .num = 0x00000000,
596 };
597 #endif
598 
618  uint32_t id;
619 };
620 
622 #ifndef __cplusplus
624  .id = 0x00000000,
625 };
626 #endif
627 
649  uint32_t index;
650 };
651 
653 #ifndef __cplusplus
655  .index = 0x00000000,
656 };
657 #endif
658 
675  uint32_t id;
676 };
677 
679 #ifndef __cplusplus
681  .id = 0xffffffff,
682 };
683 #endif
684 
704  uint32_t relative:1;
705  uint32_t search:1;
706  uint32_t reserved:30;
707  int32_t offset;
708  uint16_t limit;
709  uint16_t length;
710  const uint8_t *pattern;
711 };
712 
714 #ifndef __cplusplus
716  .relative = 1,
717  .search = 1,
718  .reserved = 0x3fffffff,
719  .offset = 0xffffffff,
720  .limit = 0xffff,
721  .length = 0xffff,
722  .pattern = NULL,
723 };
724 #endif
725 
747  uint32_t has_vlan:1;
748  uint32_t reserved:31;
749 };
750 
752 #ifndef __cplusplus
754  .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
755  .src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
756  .type = RTE_BE16(0x0000),
757 };
758 #endif
759 
778  uint32_t has_more_vlan:1;
780  uint32_t reserved:31;
781 };
782 
784 #ifndef __cplusplus
786  .tci = RTE_BE16(0x0fff),
787  .inner_type = RTE_BE16(0x0000),
788 };
789 #endif
790 
799  struct rte_ipv4_hdr hdr;
800 };
801 
803 #ifndef __cplusplus
805  .hdr = {
806  .src_addr = RTE_BE32(0xffffffff),
807  .dst_addr = RTE_BE32(0xffffffff),
808  },
809 };
810 #endif
811 
820  struct rte_ipv6_hdr hdr;
821  uint32_t has_hop_ext:1;
823  uint32_t has_route_ext:1;
825  uint32_t has_frag_ext:1;
827  uint32_t has_auth_ext:1;
829  uint32_t has_esp_ext:1;
831  uint32_t has_dest_ext:1;
833  uint32_t has_mobil_ext:1;
835  uint32_t has_hip_ext:1;
837  uint32_t has_shim6_ext:1;
839  uint32_t reserved:23;
841 };
842 
844 #ifndef __cplusplus
846  .hdr = {
847  .src_addr =
848  "\xff\xff\xff\xff\xff\xff\xff\xff"
849  "\xff\xff\xff\xff\xff\xff\xff\xff",
850  .dst_addr =
851  "\xff\xff\xff\xff\xff\xff\xff\xff"
852  "\xff\xff\xff\xff\xff\xff\xff\xff",
853  },
854 };
855 #endif
856 
863  struct rte_icmp_hdr hdr;
864 };
865 
867 #ifndef __cplusplus
869  .hdr = {
870  .icmp_type = 0xff,
871  .icmp_code = 0xff,
872  },
873 };
874 #endif
875 
882  struct rte_udp_hdr hdr;
883 };
884 
886 #ifndef __cplusplus
888  .hdr = {
889  .src_port = RTE_BE16(0xffff),
890  .dst_port = RTE_BE16(0xffff),
891  },
892 };
893 #endif
894 
901  struct rte_tcp_hdr hdr;
902 };
903 
905 #ifndef __cplusplus
907  .hdr = {
908  .src_port = RTE_BE16(0xffff),
909  .dst_port = RTE_BE16(0xffff),
910  },
911 };
912 #endif
913 
920  struct rte_sctp_hdr hdr;
921 };
922 
924 #ifndef __cplusplus
926  .hdr = {
927  .src_port = RTE_BE16(0xffff),
928  .dst_port = RTE_BE16(0xffff),
929  },
930 };
931 #endif
932 
939  uint8_t flags;
940  uint8_t rsvd0[3];
941  uint8_t vni[3];
942  uint8_t rsvd1;
943 };
944 
946 #ifndef __cplusplus
948  .vni = "\xff\xff\xff",
949 };
950 #endif
951 
968  uint8_t in_ecid_e;
969  uint8_t ecid_e;
971 };
972 
974 #ifndef __cplusplus
976  .rsvd_grp_ecid_b = RTE_BE16(0x3fff),
977 };
978 #endif
979 
994  uint8_t tni[3];
995  uint8_t flow_id;
996 };
997 
999 #ifndef __cplusplus
1001  .tni = "\xff\xff\xff",
1002 };
1003 #endif
1004 
1014  uint8_t label_tc_s[3];
1015  uint8_t ttl;
1016 };
1017 
1019 #ifndef __cplusplus
1021  .label_tc_s = "\xff\xff\xf0",
1022 };
1023 #endif
1024 
1037 };
1038 
1040 #ifndef __cplusplus
1042  .protocol = RTE_BE16(0xffff),
1043 };
1044 #endif
1045 
1064  uint32_t thresh;
1065 };
1066 
1068 #ifndef __cplusplus
1070  .thresh = 0xffffffff,
1071 };
1072 #endif
1073 
1087  uint8_t msg_type;
1090 };
1091 
1093 #ifndef __cplusplus
1095  .teid = RTE_BE32(0xffffffff),
1096 };
1097 #endif
1098 
1105  struct rte_esp_hdr hdr;
1106 };
1107 
1109 #ifndef __cplusplus
1111  .hdr = {
1112  .spi = RTE_BE32(0xffffffff),
1113  },
1114 };
1115 #endif
1116 
1129  uint8_t vni[3];
1130  uint8_t rsvd1;
1131 };
1132 
1134 #ifndef __cplusplus
1136  .vni = "\xff\xff\xff",
1137 };
1138 #endif
1139 
1146  uint8_t flags;
1147  uint8_t rsvd0[2];
1148  uint8_t protocol;
1149  uint8_t vni[3];
1150  uint8_t rsvd1;
1151 };
1152 
1154 #ifndef __cplusplus
1156  .vni = "\xff\xff\xff",
1157 };
1158 #endif
1159 
1168  uint8_t hln;
1169  uint8_t pln;
1175 };
1176 
1178 #ifndef __cplusplus
1179 static const struct rte_flow_item_arp_eth_ipv4
1181  .sha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1182  .spa = RTE_BE32(0xffffffff),
1183  .tha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1184  .tpa = RTE_BE32(0xffffffff),
1185 };
1186 #endif
1187 
1199  uint8_t next_hdr;
1200 };
1201 
1203 #ifndef __cplusplus
1204 static const
1206  .next_hdr = 0xff,
1207 };
1208 #endif
1209 
1221  struct rte_ipv6_fragment_ext hdr;
1222 };
1223 
1230  uint8_t type;
1231  uint8_t code;
1232  uint16_t checksum;
1233 };
1234 
1236 #ifndef __cplusplus
1238  .type = 0xff,
1239  .code = 0xff,
1240 };
1241 #endif
1242 
1249  uint8_t type;
1250  uint8_t code;
1253  uint8_t target_addr[16];
1254 };
1255 
1257 #ifndef __cplusplus
1258 static const
1260  .target_addr =
1261  "\xff\xff\xff\xff\xff\xff\xff\xff"
1262  "\xff\xff\xff\xff\xff\xff\xff\xff",
1263 };
1264 #endif
1265 
1272  uint8_t type;
1273  uint8_t code;
1280  uint8_t target_addr[16];
1281 };
1282 
1284 #ifndef __cplusplus
1285 static const
1287  .target_addr =
1288  "\xff\xff\xff\xff\xff\xff\xff\xff"
1289  "\xff\xff\xff\xff\xff\xff\xff\xff",
1290 };
1291 #endif
1292 
1305  uint8_t type;
1306  uint8_t length;
1307 };
1308 
1310 #ifndef __cplusplus
1311 static const struct rte_flow_item_icmp6_nd_opt
1313  .type = 0xff,
1314 };
1315 #endif
1316 
1329  uint8_t type;
1330  uint8_t length;
1332 };
1333 
1335 #ifndef __cplusplus
1336 static const struct rte_flow_item_icmp6_nd_opt_sla_eth
1338  .sla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1339 };
1340 #endif
1341 
1354  uint8_t type;
1355  uint8_t length;
1357 };
1358 
1360 #ifndef __cplusplus
1361 static const struct rte_flow_item_icmp6_nd_opt_tla_eth
1363  .tla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
1364 };
1365 #endif
1366 
1378  uint32_t data;
1379 };
1380 
1382 #ifndef __cplusplus
1384  .data = UINT32_MAX,
1385 };
1386 #endif
1387 
1394  uint8_t pdu_type;
1395  uint8_t qfi;
1396 };
1397 
1399 #ifndef __cplusplus
1400 static const struct rte_flow_item_gtp_psc
1402  .qfi = 0x3f,
1403 };
1404 #endif
1405 
1415  uint8_t version_type;
1416  uint8_t code;
1419 };
1420 
1435 };
1436 
1438 #ifndef __cplusplus
1439 static const struct rte_flow_item_pppoe_proto_id
1441  .proto_id = RTE_BE16(0xffff),
1442 };
1443 #endif
1444 
1454  uint32_t data;
1455  uint8_t index;
1456 };
1457 
1459 #ifndef __cplusplus
1461  .data = 0xffffffff,
1462  .index = 0xff,
1463 };
1464 #endif
1465 
1473 };
1474 
1476 #ifndef __cplusplus
1478  .session_id = RTE_BE32(UINT32_MAX),
1479 };
1480 #endif
1481 
1482 
1502  uint32_t id;
1503 };
1504 
1506 #ifndef __cplusplus
1508  .id = 0xffffffff,
1509 };
1510 #endif
1511 
1522  uint32_t version:2;
1523  uint32_t oam_pkt:1;
1524  uint32_t reserved:1;
1525  uint32_t ttl:6;
1526  uint32_t length:6;
1527  uint32_t reserved1:4;
1528  uint32_t mdtype:4;
1529  uint32_t next_proto:8;
1530  uint32_t spi:24;
1531  uint32_t sindex:8;
1532 };
1533 
1535 #ifndef __cplusplus
1537  .mdtype = 0xf,
1538  .next_proto = 0xff,
1539  .spi = 0xffffff,
1540  .sindex = 0xff,
1541 };
1542 #endif
1543 
1554  uint32_t type:8;
1555  uint32_t max_resp_time:8;
1556  uint32_t checksum:16;
1557  uint32_t group_addr;
1558 };
1559 
1561 #ifndef __cplusplus
1563  .group_addr = 0xffffffff,
1564 };
1565 #endif
1566 
1577  uint32_t next_hdr:8;
1578  uint32_t payload_len:8;
1579  uint32_t reserved:16;
1580  uint32_t spi;
1581  uint32_t seq_num;
1582 };
1583 
1585 #ifndef __cplusplus
1587  .spi = 0xffffffff,
1588 };
1589 #endif
1590 
1600  uint8_t s_field;
1601  uint8_t msg_type;
1602  rte_be16_t msg_len;
1603  rte_be64_t seid;
1604 };
1605 
1607 #ifndef __cplusplus
1609  .s_field = 0x01,
1610  .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
1611 };
1612 #endif
1613 
1623  struct rte_ecpri_combined_msg_hdr hdr;
1624 };
1625 
1627 #ifndef __cplusplus
1629  .hdr = {
1630  .common = {
1631  .u32 = 0x0,
1632  },
1633  },
1634 };
1635 #endif
1636 
1643  rte_be16_t option_class;
1644  uint8_t option_type;
1645  uint8_t option_len;
1646  uint32_t *data;
1647 };
1648 
1650 #ifndef __cplusplus
1651 static const struct rte_flow_item_geneve_opt
1653  .option_type = 0xff,
1654 };
1655 #endif
1656 
1692  const void *spec;
1693  const void *last;
1694  const void *mask;
1695 };
1696 
1731 
1739 
1747 
1756 
1764 
1772 
1779 
1788 
1799 
1808 
1816 
1824 
1832 
1839 
1847 
1855 
1863 
1871 
1879 
1887 
1896 
1905 
1913 
1921 
1929 
1937 
1945 
1953 
1961 
1970 
1978 
1987 
1994 
2001 
2011 
2021 
2031 
2041 
2052 
2063 
2074 
2081 
2088 
2098 
2108 
2122 
2136 
2150 
2164 
2174 
2181 
2191 
2201 
2212 
2220 
2228 
2239 };
2240 
2252  uint32_t id;
2253 };
2254 
2268  uint32_t group;
2269 };
2270 
2277  uint16_t index;
2278 };
2279 
2294  uint32_t timeout:24;
2295  uint32_t reserved:8;
2296  void *context;
2298 };
2299 
2307  uint32_t reserved:6;
2308  uint32_t aged:1;
2311  uint32_t sec_since_last_hit:24;
2312 };
2313 
2344  uint32_t shared:1;
2345  uint32_t reserved:31;
2346  uint32_t id;
2347 };
2348 
2355  uint32_t reset:1;
2356  uint32_t hits_set:1;
2357  uint32_t bytes_set:1;
2358  uint32_t reserved:29;
2359  uint64_t hits;
2360  uint64_t bytes;
2361 };
2362 
2367  RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
2376  RTE_ETH_HASH_FUNCTION_MAX,
2377 };
2378 
2422  uint32_t level;
2423  uint64_t types;
2424  uint32_t key_len;
2425  uint32_t queue_num;
2426  const uint8_t *key;
2427  const uint16_t *queue;
2428 };
2429 
2443  uint32_t original:1;
2444  uint32_t reserved:31;
2445  uint32_t id;
2446 };
2447 
2457  uint32_t original:1;
2458  uint32_t reserved:31;
2459  uint32_t index;
2460 };
2461 
2470  uint32_t original:1;
2471  uint32_t reserved:31;
2472  uint32_t id;
2473 };
2474 
2484  uint32_t mtr_id;
2485 };
2486 
2519 };
2520 
2528  uint8_t mpls_ttl;
2529 };
2530 
2538  uint8_t nw_ttl;
2539 };
2540 
2549 };
2550 
2559 };
2560 
2568  uint8_t vlan_pcp;
2569 };
2570 
2579 };
2580 
2589 };
2590 
2624 };
2625 
2658 };
2659 
2680  uint8_t *data;
2681  uint8_t *preserve;
2682  size_t size;
2683 };
2684 
2701  uint8_t *data;
2702  size_t size;
2703 };
2704 
2717  rte_be32_t ipv4_addr;
2718 };
2719 
2732  uint8_t ipv6_addr[16];
2733 };
2734 
2747  rte_be16_t port;
2748 };
2749 
2756  uint8_t ttl_value;
2757 };
2758 
2765  uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
2766 };
2767 
2778  uint32_t data;
2779  uint32_t mask;
2780  uint8_t index;
2781 };
2782 
2803  uint32_t data;
2804  uint32_t mask;
2805 };
2806 
2815  uint8_t dscp;
2816 };
2817 
2829 struct rte_flow_shared_action;
2830 
2836  RTE_FLOW_FIELD_MAC_DST,
2837  RTE_FLOW_FIELD_MAC_SRC,
2838  RTE_FLOW_FIELD_VLAN_TYPE,
2839  RTE_FLOW_FIELD_VLAN_ID,
2840  RTE_FLOW_FIELD_MAC_TYPE,
2841  RTE_FLOW_FIELD_IPV4_DSCP,
2842  RTE_FLOW_FIELD_IPV4_TTL,
2843  RTE_FLOW_FIELD_IPV4_SRC,
2844  RTE_FLOW_FIELD_IPV4_DST,
2845  RTE_FLOW_FIELD_IPV6_DSCP,
2846  RTE_FLOW_FIELD_IPV6_HOPLIMIT,
2847  RTE_FLOW_FIELD_IPV6_SRC,
2848  RTE_FLOW_FIELD_IPV6_DST,
2849  RTE_FLOW_FIELD_TCP_PORT_SRC,
2850  RTE_FLOW_FIELD_TCP_PORT_DST,
2851  RTE_FLOW_FIELD_TCP_SEQ_NUM,
2852  RTE_FLOW_FIELD_TCP_ACK_NUM,
2853  RTE_FLOW_FIELD_TCP_FLAGS,
2854  RTE_FLOW_FIELD_UDP_PORT_SRC,
2855  RTE_FLOW_FIELD_UDP_PORT_DST,
2856  RTE_FLOW_FIELD_VXLAN_VNI,
2857  RTE_FLOW_FIELD_GENEVE_VNI,
2858  RTE_FLOW_FIELD_GTP_TEID,
2859  RTE_FLOW_FIELD_TAG,
2860  RTE_FLOW_FIELD_MARK,
2861  RTE_FLOW_FIELD_META,
2864 };
2865 
2871  RTE_STD_C11
2872  union {
2873  struct {
2875  uint32_t level;
2877  uint32_t offset;
2878  };
2883  uint64_t value;
2884  };
2885 };
2886 
2894 };
2895 
2910  uint32_t width;
2911 };
2912 
2913 /* Mbuf dynamic field offset for metadata. */
2914 extern int32_t rte_flow_dynf_metadata_offs;
2915 
2916 /* Mbuf dynamic field flag mask for metadata. */
2917 extern uint64_t rte_flow_dynf_metadata_mask;
2918 
2919 /* Mbuf dynamic field pointer for metadata. */
2920 #define RTE_FLOW_DYNF_METADATA(m) \
2921  RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
2922 
2923 /* Mbuf dynamic flags for metadata. */
2924 #define PKT_RX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
2925 #define PKT_TX_DYNF_METADATA (rte_flow_dynf_metadata_mask)
2926 
2927 __rte_experimental
2928 static inline uint32_t
2929 rte_flow_dynf_metadata_get(struct rte_mbuf *m)
2930 {
2931  return *RTE_FLOW_DYNF_METADATA(m);
2932 }
2933 
2934 __rte_experimental
2935 static inline void
2936 rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
2937 {
2938  *RTE_FLOW_DYNF_METADATA(m) = v;
2939 }
2940 
2941 /*
2942  * Definition of a single action.
2943  *
2944  * A list of actions is terminated by a END action.
2945  *
2946  * For simple actions without a configuration object, conf remains NULL.
2947  */
2948 struct rte_flow_action {
2949  enum rte_flow_action_type type;
2950  const void *conf;
2951 };
2952 
2959 struct rte_flow;
2960 
2978  uint32_t ratio;
2979  const struct rte_flow_action *actions;
2981 };
2982 
3007 };
3008 
3022  const void *cause;
3023  const char *message;
3024 };
3025 
3036  union {
3037  const struct rte_flow_attr *attr_ro;
3039  };
3040  union {
3041  const struct rte_flow_item *pattern_ro;
3043  };
3044  union {
3045  const struct rte_flow_action *actions_ro;
3046  struct rte_flow_action *actions;
3047  };
3048 };
3049 
3062 
3074 
3086 
3098 
3111 
3124 
3137 
3151 
3165 
3179 
3193 };
3194 
3212 __rte_experimental
3213 int
3214 rte_flow_dev_dump(uint16_t port_id, FILE *file, struct rte_flow_error *error);
3215 
3222 __rte_experimental
3223 static inline int
3225 {
3226  return !!rte_flow_dynf_metadata_mask;
3227 }
3228 
3239 __rte_experimental
3240 int
3242 
3295 int
3296 rte_flow_validate(uint16_t port_id,
3297  const struct rte_flow_attr *attr,
3298  const struct rte_flow_item pattern[],
3299  const struct rte_flow_action actions[],
3300  struct rte_flow_error *error);
3301 
3322 struct rte_flow *
3323 rte_flow_create(uint16_t port_id,
3324  const struct rte_flow_attr *attr,
3325  const struct rte_flow_item pattern[],
3326  const struct rte_flow_action actions[],
3327  struct rte_flow_error *error);
3328 
3349 int
3350 rte_flow_destroy(uint16_t port_id,
3351  struct rte_flow *flow,
3352  struct rte_flow_error *error);
3353 
3370 int
3371 rte_flow_flush(uint16_t port_id,
3372  struct rte_flow_error *error);
3373 
3398 int
3399 rte_flow_query(uint16_t port_id,
3400  struct rte_flow *flow,
3401  const struct rte_flow_action *action,
3402  void *data,
3403  struct rte_flow_error *error);
3404 
3446 int
3447 rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
3448 
3466 int
3467 rte_flow_error_set(struct rte_flow_error *error,
3468  int code,
3469  enum rte_flow_error_type type,
3470  const void *cause,
3471  const char *message);
3472 
3478  size_t size;
3481  struct rte_flow_action *actions;
3482  uint8_t data[];
3483 };
3484 
3511 __rte_deprecated
3512 size_t
3513 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
3514  const struct rte_flow_attr *attr,
3515  const struct rte_flow_item *items,
3516  const struct rte_flow_action *actions);
3517 
3558 __rte_experimental
3559 int
3561  void *dst,
3562  size_t size,
3563  const void *src,
3564  struct rte_flow_error *error);
3565 
3594 __rte_experimental
3595 int
3596 rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
3597  uint32_t nb_contexts, struct rte_flow_error *error);
3598 
3609  uint32_t ingress:1;
3611  uint32_t egress:1;
3620  uint32_t transfer:1;
3621 };
3622 
3649 __rte_experimental
3650 struct rte_flow_shared_action *
3651 rte_flow_shared_action_create(uint16_t port_id,
3652  const struct rte_flow_shared_action_conf *conf,
3653  const struct rte_flow_action *action,
3654  struct rte_flow_error *error);
3655 
3678 __rte_experimental
3679 int
3680 rte_flow_shared_action_destroy(uint16_t port_id,
3681  struct rte_flow_shared_action *action,
3682  struct rte_flow_error *error);
3683 
3714 __rte_experimental
3715 int
3716 rte_flow_shared_action_update(uint16_t port_id,
3717  struct rte_flow_shared_action *action,
3718  const struct rte_flow_action *update,
3719  struct rte_flow_error *error);
3720 
3746 __rte_experimental
3747 int
3748 rte_flow_shared_action_query(uint16_t port_id,
3749  const struct rte_flow_shared_action *action,
3750  void *data,
3751  struct rte_flow_error *error);
3752 
3753 /* Tunnel has a type and the key information. */
3754 struct rte_flow_tunnel {
3759  enum rte_flow_item_type type;
3760  uint64_t tun_id;
3762  RTE_STD_C11
3763  union {
3764  struct {
3765  rte_be32_t src_addr;
3766  rte_be32_t dst_addr;
3767  } ipv4;
3768  struct {
3769  uint8_t src_addr[16];
3770  uint8_t dst_addr[16];
3771  } ipv6;
3772  };
3773  rte_be16_t tp_src;
3774  rte_be16_t tp_dst;
3775  uint16_t tun_flags;
3777  bool is_ipv6;
3783  uint8_t tos;
3784  uint8_t ttl;
3785  uint32_t label;
3786 };
3787 
3791 #define RTE_FLOW_RESTORE_INFO_TUNNEL (1ULL << 0)
3792 
3796 #define RTE_FLOW_RESTORE_INFO_ENCAPSULATED (1ULL << 1)
3797 
3801 #define RTE_FLOW_RESTORE_INFO_GROUP_ID (1ULL << 2)
3802 
3813  uint64_t flags;
3814  uint32_t group_id;
3815  struct rte_flow_tunnel tunnel;
3816 };
3817 
3841 __rte_experimental
3842 int
3843 rte_flow_tunnel_decap_set(uint16_t port_id,
3844  struct rte_flow_tunnel *tunnel,
3845  struct rte_flow_action **actions,
3846  uint32_t *num_of_actions,
3847  struct rte_flow_error *error);
3848 
3872 __rte_experimental
3873 int
3874 rte_flow_tunnel_match(uint16_t port_id,
3875  struct rte_flow_tunnel *tunnel,
3876  struct rte_flow_item **items,
3877  uint32_t *num_of_items,
3878  struct rte_flow_error *error);
3879 
3896 __rte_experimental
3897 int
3898 rte_flow_get_restore_info(uint16_t port_id,
3899  struct rte_mbuf *m,
3900  struct rte_flow_restore_info *info,
3901  struct rte_flow_error *error);
3902 
3919 __rte_experimental
3920 int
3921 rte_flow_tunnel_action_decap_release(uint16_t port_id,
3922  struct rte_flow_action *actions,
3923  uint32_t num_of_actions,
3924  struct rte_flow_error *error);
3925 
3942 __rte_experimental
3943 int
3944 rte_flow_tunnel_item_release(uint16_t port_id,
3945  struct rte_flow_item *items,
3946  uint32_t num_of_items,
3947  struct rte_flow_error *error);
3948 #ifdef __cplusplus
3949 }
3950 #endif
3951 
3952 #endif /* RTE_FLOW_H_ */
uint32_t reserved
Definition: rte_flow.h:100
static const struct rte_flow_item_icmp6_nd_opt_sla_eth rte_flow_item_icmp6_nd_opt_sla_eth_mask
Definition: rte_flow.h:1337
rte_be32_t u32
Definition: rte_ecpri.h:72
rte_flow_field_id
Definition: rte_flow.h:2834
rte_be16_t c_rsvd0_ver
Definition: rte_flow.h:1035
rte_be16_t ver_opt_len_o_c_rsvd0
Definition: rte_flow.h:1127
uint32_t reserved
Definition: rte_flow.h:839
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:3046
static const struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask
Definition: rte_flow.h:1286
static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask
Definition: rte_flow.h:845
rte_be16_t epcp_edei_in_ecid_b
Definition: rte_flow.h:965
rte_be16_t protocol
Definition: rte_flow.h:1128
static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask
Definition: rte_flow.h:1608
uint32_t has_auth_ext
Definition: rte_flow.h:827
uint32_t num
Definition: rte_flow.h:589
struct rte_flow_attr * attr
Definition: rte_flow.h:3038
__rte_experimental struct rte_flow_shared_action * rte_flow_shared_action_create(uint16_t port_id, const struct rte_flow_shared_action_conf *conf, const struct rte_flow_action *action, struct rte_flow_error *error)
uint32_t has_mobil_ext
Definition: rte_flow.h:833
uint32_t sec_since_last_hit
Definition: rte_flow.h:2311
uint32_t rte_be32_t
uint32_t original
Definition: rte_flow.h:2443
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:77
struct rte_flow_item * definition
Definition: rte_flow.h:2623
static const struct rte_flow_item_gre rte_flow_item_gre_mask
Definition: rte_flow.h:1041
struct rte_flow_attr attr
Definition: rte_flow.h:3479
rte_be16_t msg_len
Definition: rte_flow.h:1088
static const struct rte_flow_item_gtp rte_flow_item_gtp_mask
Definition: rte_flow.h:1094
static const struct rte_flow_item_icmp rte_flow_item_icmp_mask
Definition: rte_flow.h:868
#define RTE_ETHER_ADDR_LEN
Definition: rte_ether.h:30
static const struct rte_flow_item_geneve rte_flow_item_geneve_mask
Definition: rte_flow.h:1135
const struct rte_flow_attr * attr_ro
Definition: rte_flow.h:3037
static const struct rte_flow_item_sctp rte_flow_item_sctp_mask
Definition: rte_flow.h:925
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:594
static const struct rte_flow_item_meta rte_flow_item_meta_mask
Definition: rte_flow.h:1383
static const struct rte_flow_item_esp rte_flow_item_esp_mask
Definition: rte_flow.h:1110
__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:863
__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:1086
struct rte_ether_addr tla
Definition: rte_flow.h:1356
rte_be16_t protocol
Definition: rte_flow.h:993
uint32_t reserved
Definition: rte_flow.h:706
rte_be32_t spi
Definition: rte_esp.h:24
static const struct rte_flow_item_geneve_opt rte_flow_item_geneve_opt_mask
Definition: rte_flow.h:1652
static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask
Definition: rte_flow.h:1237
rte_be16_t src_port
Definition: rte_sctp.h:29
struct rte_flow_action * actions
Definition: rte_flow.h:3481
uint8_t data[]
Definition: rte_flow.h:3482
struct rte_ether_addr tha
Definition: rte_flow.h:1173
struct rte_ipv4_hdr hdr
Definition: rte_flow.h:799
static const struct rte_flow_item_mark rte_flow_item_mark_mask
Definition: rte_flow.h:1507
uint32_t reserved
Definition: rte_flow.h:2307
rte_be32_t src_addr
Definition: rte_ip.h:42
static const struct rte_flow_item_icmp6_nd_opt rte_flow_item_icmp6_nd_opt_mask
Definition: rte_flow.h:1312
static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask
Definition: rte_flow.h:654
static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask
Definition: rte_flow.h:947
uint8_t src_addr[16]
Definition: rte_ip.h:392
static const struct rte_flow_item_port_id rte_flow_item_port_id_mask
Definition: rte_flow.h:680
static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask
Definition: rte_flow.h:567
static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask
Definition: rte_flow.h:1000
uint64_t rte_be64_t
const void * mask
Definition: rte_flow.h:1694
struct rte_flow_item * pattern
Definition: rte_flow.h:3042
enum rte_eth_hash_function func
Definition: rte_flow.h:2396
rte_be16_t type
Definition: rte_flow.h:746
enum rte_flow_error_type type
Definition: rte_flow.h:3021
const void * cause
Definition: rte_flow.h:3022
__rte_experimental int rte_flow_shared_action_destroy(uint16_t port_id, struct rte_flow_shared_action *action, struct rte_flow_error *error)
enum rte_flow_field_id field
Definition: rte_flow.h:2870
static const struct rte_flow_item_udp rte_flow_item_udp_mask
Definition: rte_flow.h:887
struct rte_esp_hdr hdr
Definition: rte_flow.h:1105
rte_flow_error_type
Definition: rte_flow.h:2989
uint32_t has_esp_ext
Definition: rte_flow.h:829
rte_flow_conv_op
Definition: rte_flow.h:3055
rte_be16_t src_port
Definition: rte_udp.h:29
uint32_t has_shim6_ext
Definition: rte_flow.h:837
uint32_t has_route_ext
Definition: rte_flow.h:823
__rte_experimental int rte_flow_shared_action_update(uint16_t port_id, struct rte_flow_shared_action *action, const struct rte_flow_action *update, struct rte_flow_error *error)
uint32_t id
Definition: rte_flow.h:618
const uint8_t * pattern
Definition: rte_flow.h:710
uint32_t search
Definition: rte_flow.h:705
rte_be16_t rsvd_grp_ecid_b
Definition: rte_flow.h:967
static const struct rte_flow_item_raw rte_flow_item_raw_mask
Definition: rte_flow.h:715
uint16_t limit
Definition: rte_flow.h:708
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:1020
static const struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask
Definition: rte_flow.h:1259
struct rte_flow_action_modify_data src
Definition: rte_flow.h:2909
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 char * message
Definition: rte_flow.h:3023
rte_eth_hash_function
Definition: rte_flow.h:2366
uint16_t length
Definition: rte_flow.h:709
const void * last
Definition: rte_flow.h:1693
static const struct rte_flow_item_icmp6_nd_opt_tla_eth rte_flow_item_icmp6_nd_opt_tla_eth_mask
Definition: rte_flow.h:1362
rte_be32_t teid
Definition: rte_flow.h:1089
int rte_flow_destroy(uint16_t port_id, struct rte_flow *flow, struct rte_flow_error *error)
uint32_t ingress
Definition: rte_flow.h:79
enum rte_flow_item_type type
Definition: rte_flow.h:1691
rte_be16_t tci
Definition: rte_flow.h:776
static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask
Definition: rte_flow.h:804
size_t size
Definition: rte_flow.h:3478
rte_be16_t c_k_s_rsvd0_ver
Definition: rte_flow.h:992
static const struct rte_flow_item_gtp_psc rte_flow_item_gtp_psc_mask
Definition: rte_flow.h:1401
rte_be16_t length
Definition: rte_flow.h:1418
const struct rte_flow_action * actions_ro
Definition: rte_flow.h:3045
uint32_t has_vlan
Definition: rte_flow.h:747
uint32_t has_more_vlan
Definition: rte_flow.h:778
struct rte_flow_item * items
Definition: rte_flow.h:3480
enum rte_flow_modify_op operation
Definition: rte_flow.h:2907
__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:1723
struct rte_ether_addr sla
Definition: rte_flow.h:1331
struct rte_flow_action_modify_data dst
Definition: rte_flow.h:2908
rte_flow_modify_op
Definition: rte_flow.h:2890
uint32_t has_hop_ext
Definition: rte_flow.h:821
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)
struct rte_ether_addr dst
Definition: rte_flow.h:744
static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask
Definition: rte_flow.h:1477
static const struct rte_flow_item_igmp rte_flow_item_igmp_mask
Definition: rte_flow.h:1562
const void * spec
Definition: rte_flow.h:1692
uint8_t label_tc_s[3]
Definition: rte_flow.h:1014
uint8_t version_type
Definition: rte_flow.h:1415
#define RTE_STD_C11
Definition: rte_common.h:40
__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:2426
static const struct rte_flow_item_arp_eth_ipv4 rte_flow_item_arp_eth_ipv4_mask
Definition: rte_flow.h:1180
uint32_t has_hip_ext
Definition: rte_flow.h:835
const struct rte_flow_action * actions
Definition: rte_flow.h:2979
uint32_t sec_since_last_hit_valid
Definition: rte_flow.h:2309
struct rte_ether_addr sha
Definition: rte_flow.h:1171
static const struct rte_flow_item_eth rte_flow_item_eth_mask
Definition: rte_flow.h:753
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:825
uint32_t reserved
Definition: rte_flow.h:2444
__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:1586
static const struct rte_flow_item_tag rte_flow_item_tag_mask
Definition: rte_flow.h:1460
uint32_t priority
Definition: rte_flow.h:78
uint32_t has_dest_ext
Definition: rte_flow.h:831
struct rte_ether_addr src
Definition: rte_flow.h:745
static const struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask
Definition: rte_flow.h:1205
static const struct rte_flow_item_vf rte_flow_item_vf_mask
Definition: rte_flow.h:623
struct rte_ipv6_hdr hdr
Definition: rte_flow.h:820
__rte_experimental int rte_flow_shared_action_query(uint16_t port_id, const struct rte_flow_shared_action *action, void *data, struct rte_flow_error *error)
static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask
Definition: rte_flow.h:1628
rte_be16_t protocol
Definition: rte_flow.h:1036
uint32_t queue_num
Definition: rte_flow.h:2425
uint8_t tni[3]
Definition: rte_flow.h:994
struct rte_tcp_hdr hdr
Definition: rte_flow.h:901
static const struct rte_flow_item_pppoe_proto_id rte_flow_item_pppoe_proto_id_mask
Definition: rte_flow.h:1440
__rte_experimental int rte_flow_dev_dump(uint16_t port_id, FILE *file, struct rte_flow_error *error)
uint32_t transfer
Definition: rte_flow.h:99
struct rte_flow_item * definition
Definition: rte_flow.h:2657
static const struct rte_flow_item_vlan rte_flow_item_vlan_mask
Definition: rte_flow.h:785
uint8_t msg_type
Definition: rte_flow.h:1087
uint32_t reserved
Definition: rte_flow.h:780
uint32_t egress
Definition: rte_flow.h:80
static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask
Definition: rte_flow.h:975
static __rte_experimental int rte_flow_dynf_metadata_avail(void)
Definition: rte_flow.h:3224
__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:906
static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask
Definition: rte_flow.h:1069
uint8_t addr_bytes[RTE_ETHER_ADDR_LEN]
Definition: rte_ether.h:65
rte_be16_t inner_type
Definition: rte_flow.h:777
uint8_t rsvd0[3]
Definition: rte_flow.h:940
__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:882
const uint16_t * queue
Definition: rte_flow.h:2427
rte_flow_item_type
Definition: rte_flow.h:119
uint32_t relative
Definition: rte_flow.h:704
struct rte_flow_tunnel tunnel
Definition: rte_flow.h:3815
uint8_t vni[3]
Definition: rte_flow.h:941
int32_t offset
Definition: rte_flow.h:707
rte_be16_t inner_type
Definition: rte_flow.h:970
__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:3041
static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask
Definition: rte_flow.h:1155
rte_be16_t session_id
Definition: rte_flow.h:1417
static const struct rte_flow_item_nsh rte_flow_item_nsh_mask
Definition: rte_flow.h:1536
struct rte_sctp_hdr hdr
Definition: rte_flow.h:920
uint32_t reserved
Definition: rte_flow.h:748