DPDK  18.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.
4  */
5 
6 #ifndef RTE_FLOW_H_
7 #define RTE_FLOW_H_
8 
17 #include <rte_arp.h>
18 #include <rte_ether.h>
19 #include <rte_icmp.h>
20 #include <rte_ip.h>
21 #include <rte_sctp.h>
22 #include <rte_tcp.h>
23 #include <rte_udp.h>
24 #include <rte_byteorder.h>
25 #include <rte_esp.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
66 struct rte_flow_attr {
67  uint32_t group;
68  uint32_t priority;
69  uint32_t ingress:1;
70  uint32_t egress:1;
71  uint32_t reserved:30;
72 };
73 
102 
112 
122 
130 
145 
160 
175 
182 
189 
196 
203 
210 
217 
224 
231 
238 
245 
252 
259 
266 
273 
285 
294 
303 
312 
319 
326 };
327 
340  uint32_t num;
341 };
342 
344 #ifndef __cplusplus
346  .num = 0x00000000,
347 };
348 #endif
349 
369  uint32_t id;
370 };
371 
373 #ifndef __cplusplus
375  .id = 0x00000000,
376 };
377 #endif
378 
400  uint32_t index;
401 };
402 
404 #ifndef __cplusplus
406  .index = 0x00000000,
407 };
408 #endif
409 
429  uint32_t relative:1;
430  uint32_t search:1;
431  uint32_t reserved:30;
432  int32_t offset;
433  uint16_t limit;
434  uint16_t length;
435  uint8_t pattern[];
436 };
437 
439 #ifndef __cplusplus
441  .relative = 1,
442  .search = 1,
443  .reserved = 0x3fffffff,
444  .offset = 0xffffffff,
445  .limit = 0xffff,
446  .length = 0xffff,
447 };
448 #endif
449 
456  struct ether_addr dst;
457  struct ether_addr src;
459 };
460 
462 #ifndef __cplusplus
464  .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
465  .src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
466  .type = RTE_BE16(0x0000),
467 };
468 #endif
469 
481 };
482 
484 #ifndef __cplusplus
486  .tpid = RTE_BE16(0x0000),
487  .tci = RTE_BE16(0xffff),
488 };
489 #endif
490 
499  struct ipv4_hdr hdr;
500 };
501 
503 #ifndef __cplusplus
505  .hdr = {
506  .src_addr = RTE_BE32(0xffffffff),
507  .dst_addr = RTE_BE32(0xffffffff),
508  },
509 };
510 #endif
511 
520  struct ipv6_hdr hdr;
521 };
522 
524 #ifndef __cplusplus
526  .hdr = {
527  .src_addr =
528  "\xff\xff\xff\xff\xff\xff\xff\xff"
529  "\xff\xff\xff\xff\xff\xff\xff\xff",
530  .dst_addr =
531  "\xff\xff\xff\xff\xff\xff\xff\xff"
532  "\xff\xff\xff\xff\xff\xff\xff\xff",
533  },
534 };
535 #endif
536 
543  struct icmp_hdr hdr;
544 };
545 
547 #ifndef __cplusplus
549  .hdr = {
550  .icmp_type = 0xff,
551  .icmp_code = 0xff,
552  },
553 };
554 #endif
555 
562  struct udp_hdr hdr;
563 };
564 
566 #ifndef __cplusplus
568  .hdr = {
569  .src_port = RTE_BE16(0xffff),
570  .dst_port = RTE_BE16(0xffff),
571  },
572 };
573 #endif
574 
581  struct tcp_hdr hdr;
582 };
583 
585 #ifndef __cplusplus
587  .hdr = {
588  .src_port = RTE_BE16(0xffff),
589  .dst_port = RTE_BE16(0xffff),
590  },
591 };
592 #endif
593 
600  struct sctp_hdr hdr;
601 };
602 
604 #ifndef __cplusplus
606  .hdr = {
607  .src_port = RTE_BE16(0xffff),
608  .dst_port = RTE_BE16(0xffff),
609  },
610 };
611 #endif
612 
619  uint8_t flags;
620  uint8_t rsvd0[3];
621  uint8_t vni[3];
622  uint8_t rsvd1;
623 };
624 
626 #ifndef __cplusplus
628  .vni = "\xff\xff\xff",
629 };
630 #endif
631 
646  uint8_t in_ecid_e;
647  uint8_t ecid_e;
648 };
649 
651 #ifndef __cplusplus
653  .rsvd_grp_ecid_b = RTE_BE16(0x3fff),
654 };
655 #endif
656 
671  uint8_t tni[3];
672  uint8_t flow_id;
673 };
674 
676 #ifndef __cplusplus
678  .tni = "\xff\xff\xff",
679 };
680 #endif
681 
691  uint8_t label_tc_s[3];
692  uint8_t ttl;
693 };
694 
696 #ifndef __cplusplus
698  .label_tc_s = "\xff\xff\xf0",
699 };
700 #endif
701 
714 };
715 
717 #ifndef __cplusplus
719  .protocol = RTE_BE16(0xffff),
720 };
721 #endif
722 
741  uint32_t thresh;
742 };
743 
745 #ifndef __cplusplus
747  .thresh = 0xffffffff,
748 };
749 #endif
750 
763  uint8_t v_pt_rsv_flags;
764  uint8_t msg_type;
767 };
768 
770 #ifndef __cplusplus
772  .teid = RTE_BE32(0xffffffff),
773 };
774 #endif
775 
782  struct esp_hdr hdr;
783 };
784 
786 #ifndef __cplusplus
788  .hdr = {
789  .spi = 0xffffffff,
790  },
791 };
792 #endif
793 
806  uint8_t vni[3];
807  uint8_t rsvd1;
808 };
809 
811 #ifndef __cplusplus
813  .vni = "\xff\xff\xff",
814 };
815 #endif
816 
852  const void *spec;
853  const void *last;
854  const void *mask;
855 };
856 
895 
905 
915 
925 
935 
942 
951 
963 
973 
982 
990 
998 
1006 
1014 };
1015 
1027  uint32_t id;
1028 };
1029 
1038  uint16_t index;
1039 };
1040 
1047  uint32_t reset:1;
1048  uint32_t hits_set:1;
1049  uint32_t bytes_set:1;
1050  uint32_t reserved:29;
1051  uint64_t hits;
1052  uint64_t bytes;
1053 };
1054 
1066  uint16_t index;
1067 };
1068 
1082  const struct rte_eth_rss_conf *rss_conf;
1083  uint16_t num;
1084  uint16_t queue[];
1085 };
1086 
1101  uint32_t original:1;
1102  uint32_t reserved:31;
1103  uint32_t id;
1104 };
1105 
1117  uint32_t mtr_id;
1118 };
1119 
1149 };
1150 
1160  const void *conf;
1161 };
1162 
1169 struct rte_flow;
1170 
1190 };
1191 
1205  const void *cause;
1206  const char *message;
1207 };
1208 
1261 int
1262 rte_flow_validate(uint16_t port_id,
1263  const struct rte_flow_attr *attr,
1264  const struct rte_flow_item pattern[],
1265  const struct rte_flow_action actions[],
1266  struct rte_flow_error *error);
1267 
1288 struct rte_flow *
1289 rte_flow_create(uint16_t port_id,
1290  const struct rte_flow_attr *attr,
1291  const struct rte_flow_item pattern[],
1292  const struct rte_flow_action actions[],
1293  struct rte_flow_error *error);
1294 
1315 int
1316 rte_flow_destroy(uint16_t port_id,
1317  struct rte_flow *flow,
1318  struct rte_flow_error *error);
1319 
1336 int
1337 rte_flow_flush(uint16_t port_id,
1338  struct rte_flow_error *error);
1339 
1364 int
1365 rte_flow_query(uint16_t port_id,
1366  struct rte_flow *flow,
1367  enum rte_flow_action_type action,
1368  void *data,
1369  struct rte_flow_error *error);
1370 
1412 int
1413 rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
1414 
1432 int
1433 rte_flow_error_set(struct rte_flow_error *error,
1434  int code,
1435  enum rte_flow_error_type type,
1436  const void *cause,
1437  const char *message);
1438 
1446  size_t size;
1450  uint8_t data[];
1451 };
1452 
1473 size_t
1474 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
1475  const struct rte_flow_attr *attr,
1476  const struct rte_flow_item *items,
1477  const struct rte_flow_action *actions);
1478 
1479 #ifdef __cplusplus
1480 }
1481 #endif
1482 
1483 #endif /* RTE_FLOW_H_ */
uint32_t reserved
Definition: rte_flow.h:71
rte_be16_t c_rsvd0_ver
Definition: rte_flow.h:712
rte_be16_t ver_opt_len_o_c_rsvd0
Definition: rte_flow.h:804
uint8_t pattern[]
Definition: rte_flow.h:435
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)
static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask
Definition: rte_flow.h:525
rte_be16_t epcp_edei_in_ecid_b
Definition: rte_flow.h:643
rte_be16_t protocol
Definition: rte_flow.h:805
uint32_t num
Definition: rte_flow.h:340
uint32_t rte_be32_t
uint32_t src_addr
Definition: rte_ip.h:40
uint32_t original
Definition: rte_flow.h:1101
struct ether_addr src
Definition: rte_flow.h:457
uint32_t group
Definition: rte_flow.h:67
static const struct rte_flow_item_gre rte_flow_item_gre_mask
Definition: rte_flow.h:718
struct rte_flow_attr attr
Definition: rte_flow.h:1447
rte_be16_t msg_len
Definition: rte_flow.h:765
static const struct rte_flow_item_gtp rte_flow_item_gtp_mask
Definition: rte_flow.h:771
static const struct rte_flow_item_icmp rte_flow_item_icmp_mask
Definition: rte_flow.h:548
struct tcp_hdr hdr
Definition: rte_flow.h:581
static const struct rte_flow_item_geneve rte_flow_item_geneve_mask
Definition: rte_flow.h:812
static const struct rte_flow_item_sctp rte_flow_item_sctp_mask
Definition: rte_flow.h:605
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:345
static const struct rte_flow_item_esp rte_flow_item_esp_mask
Definition: rte_flow.h:787
struct sctp_hdr hdr
Definition: rte_flow.h:600
uint8_t v_pt_rsv_flags
Definition: rte_flow.h:763
rte_be16_t protocol
Definition: rte_flow.h:670
uint32_t reserved
Definition: rte_flow.h:431
struct rte_flow_action * actions
Definition: rte_flow.h:1449
uint8_t data[]
Definition: rte_flow.h:1450
static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask
Definition: rte_flow.h:627
struct udp_hdr hdr
Definition: rte_flow.h:562
struct icmp_hdr hdr
Definition: rte_flow.h:543
static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask
Definition: rte_flow.h:677
rte_be32_t spi
Definition: rte_esp.h:24
const void * mask
Definition: rte_flow.h:854
rte_be16_t type
Definition: rte_flow.h:458
enum rte_flow_error_type type
Definition: rte_flow.h:1204
const void * cause
Definition: rte_flow.h:1205
struct ipv6_hdr hdr
Definition: rte_flow.h:520
uint16_t src_port
Definition: rte_sctp.h:27
static const struct rte_flow_item_udp rte_flow_item_udp_mask
Definition: rte_flow.h:567
rte_flow_error_type
Definition: rte_flow.h:1177
int rte_flow_query(uint16_t port_id, struct rte_flow *flow, enum rte_flow_action_type action, void *data, struct rte_flow_error *error)
rte_be16_t tpid
Definition: rte_flow.h:638
uint32_t id
Definition: rte_flow.h:369
uint32_t search
Definition: rte_flow.h:430
uint8_t addr_bytes[ETHER_ADDR_LEN]
Definition: rte_ether.h:58
rte_be16_t rsvd_grp_ecid_b
Definition: rte_flow.h:645
uint32_t index
Definition: rte_flow.h:400
uint8_t src_addr[16]
Definition: rte_ip.h:344
static const struct rte_flow_item_raw rte_flow_item_raw_mask
Definition: rte_flow.h:440
uint16_t limit
Definition: rte_flow.h:433
uint8_t vni[3]
Definition: rte_flow.h:806
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:697
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:1160
const char * message
Definition: rte_flow.h:1206
uint16_t length
Definition: rte_flow.h:434
const void * last
Definition: rte_flow.h:853
rte_be32_t teid
Definition: rte_flow.h:766
int rte_flow_destroy(uint16_t port_id, struct rte_flow *flow, struct rte_flow_error *error)
uint32_t ingress
Definition: rte_flow.h:69
enum rte_flow_item_type type
Definition: rte_flow.h:851
rte_be16_t tci
Definition: rte_flow.h:480
struct ipv4_hdr hdr
Definition: rte_flow.h:499
static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask
Definition: rte_flow.h:504
size_t size
Definition: rte_flow.h:1446
rte_be16_t c_k_s_rsvd0_ver
Definition: rte_flow.h:669
struct rte_flow_item * items
Definition: rte_flow.h:1448
rte_flow_action_type
Definition: rte_flow.h:885
rte_be16_t tpid
Definition: rte_flow.h:479
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)
const struct rte_eth_rss_conf * rss_conf
Definition: rte_flow.h:1082
const void * spec
Definition: rte_flow.h:852
uint8_t label_tc_s[3]
Definition: rte_flow.h:691
uint16_t queue[]
Definition: rte_flow.h:1084
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)
uint16_t src_port
Definition: rte_udp.h:27
static const struct rte_flow_item_eth rte_flow_item_eth_mask
Definition: rte_flow.h:463
struct esp_hdr hdr
Definition: rte_flow.h:782
uint16_t rte_be16_t
uint16_t src_port
Definition: rte_tcp.h:27
struct ether_addr dst
Definition: rte_flow.h:456
uint32_t reserved
Definition: rte_flow.h:1102
uint32_t priority
Definition: rte_flow.h:68
static const struct rte_flow_item_port rte_flow_item_port_mask
Definition: rte_flow.h:405
static const struct rte_flow_item_vf rte_flow_item_vf_mask
Definition: rte_flow.h:374
rte_be16_t protocol
Definition: rte_flow.h:713
uint8_t tni[3]
Definition: rte_flow.h:671
static const struct rte_flow_item_vlan rte_flow_item_vlan_mask
Definition: rte_flow.h:485
uint8_t msg_type
Definition: rte_flow.h:764
uint32_t egress
Definition: rte_flow.h:70
static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask
Definition: rte_flow.h:652
static const struct rte_flow_item_tcp rte_flow_item_tcp_mask
Definition: rte_flow.h:586
static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask
Definition: rte_flow.h:746
enum rte_flow_action_type type
Definition: rte_flow.h:1159
uint8_t rsvd0[3]
Definition: rte_flow.h:620
rte_flow_item_type
Definition: rte_flow.h:92
uint32_t relative
Definition: rte_flow.h:429
uint8_t vni[3]
Definition: rte_flow.h:621
int32_t offset
Definition: rte_flow.h:432