DPDK  18.02.2
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 <stdint.h>
18 
19 #include <rte_arp.h>
20 #include <rte_ether.h>
21 #include <rte_icmp.h>
22 #include <rte_ip.h>
23 #include <rte_sctp.h>
24 #include <rte_tcp.h>
25 #include <rte_udp.h>
26 #include <rte_byteorder.h>
27 #include <rte_esp.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
68 struct rte_flow_attr {
69  uint32_t group;
70  uint32_t priority;
71  uint32_t ingress:1;
72  uint32_t egress:1;
73  uint32_t reserved:30;
74 };
75 
104 
114 
124 
132 
147 
162 
177 
184 
191 
198 
205 
212 
219 
226 
233 
240 
247 
254 
261 
268 
275 
287 
296 
305 
314 
321 
328 };
329 
342  uint32_t num;
343 };
344 
346 #ifndef __cplusplus
348  .num = 0x00000000,
349 };
350 #endif
351 
371  uint32_t id;
372 };
373 
375 #ifndef __cplusplus
377  .id = 0x00000000,
378 };
379 #endif
380 
402  uint32_t index;
403 };
404 
406 #ifndef __cplusplus
408  .index = 0x00000000,
409 };
410 #endif
411 
431  uint32_t relative:1;
432  uint32_t search:1;
433  uint32_t reserved:30;
434  int32_t offset;
435  uint16_t limit;
436  uint16_t length;
437  uint8_t pattern[];
438 };
439 
441 #ifndef __cplusplus
443  .relative = 1,
444  .search = 1,
445  .reserved = 0x3fffffff,
446  .offset = 0xffffffff,
447  .limit = 0xffff,
448  .length = 0xffff,
449 };
450 #endif
451 
458  struct ether_addr dst;
459  struct ether_addr src;
461 };
462 
464 #ifndef __cplusplus
466  .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
467  .src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
468  .type = RTE_BE16(0x0000),
469 };
470 #endif
471 
483 };
484 
486 #ifndef __cplusplus
488  .tpid = RTE_BE16(0x0000),
489  .tci = RTE_BE16(0xffff),
490 };
491 #endif
492 
501  struct ipv4_hdr hdr;
502 };
503 
505 #ifndef __cplusplus
507  .hdr = {
508  .src_addr = RTE_BE32(0xffffffff),
509  .dst_addr = RTE_BE32(0xffffffff),
510  },
511 };
512 #endif
513 
522  struct ipv6_hdr hdr;
523 };
524 
526 #ifndef __cplusplus
528  .hdr = {
529  .src_addr =
530  "\xff\xff\xff\xff\xff\xff\xff\xff"
531  "\xff\xff\xff\xff\xff\xff\xff\xff",
532  .dst_addr =
533  "\xff\xff\xff\xff\xff\xff\xff\xff"
534  "\xff\xff\xff\xff\xff\xff\xff\xff",
535  },
536 };
537 #endif
538 
545  struct icmp_hdr hdr;
546 };
547 
549 #ifndef __cplusplus
551  .hdr = {
552  .icmp_type = 0xff,
553  .icmp_code = 0xff,
554  },
555 };
556 #endif
557 
564  struct udp_hdr hdr;
565 };
566 
568 #ifndef __cplusplus
570  .hdr = {
571  .src_port = RTE_BE16(0xffff),
572  .dst_port = RTE_BE16(0xffff),
573  },
574 };
575 #endif
576 
583  struct tcp_hdr hdr;
584 };
585 
587 #ifndef __cplusplus
589  .hdr = {
590  .src_port = RTE_BE16(0xffff),
591  .dst_port = RTE_BE16(0xffff),
592  },
593 };
594 #endif
595 
602  struct sctp_hdr hdr;
603 };
604 
606 #ifndef __cplusplus
608  .hdr = {
609  .src_port = RTE_BE16(0xffff),
610  .dst_port = RTE_BE16(0xffff),
611  },
612 };
613 #endif
614 
621  uint8_t flags;
622  uint8_t rsvd0[3];
623  uint8_t vni[3];
624  uint8_t rsvd1;
625 };
626 
628 #ifndef __cplusplus
630  .vni = "\xff\xff\xff",
631 };
632 #endif
633 
648  uint8_t in_ecid_e;
649  uint8_t ecid_e;
650 };
651 
653 #ifndef __cplusplus
655  .rsvd_grp_ecid_b = RTE_BE16(0x3fff),
656 };
657 #endif
658 
673  uint8_t tni[3];
674  uint8_t flow_id;
675 };
676 
678 #ifndef __cplusplus
680  .tni = "\xff\xff\xff",
681 };
682 #endif
683 
693  uint8_t label_tc_s[3];
694  uint8_t ttl;
695 };
696 
698 #ifndef __cplusplus
700  .label_tc_s = "\xff\xff\xf0",
701 };
702 #endif
703 
716 };
717 
719 #ifndef __cplusplus
721  .protocol = RTE_BE16(0xffff),
722 };
723 #endif
724 
743  uint32_t thresh;
744 };
745 
747 #ifndef __cplusplus
749  .thresh = 0xffffffff,
750 };
751 #endif
752 
765  uint8_t v_pt_rsv_flags;
766  uint8_t msg_type;
769 };
770 
772 #ifndef __cplusplus
774  .teid = RTE_BE32(0xffffffff),
775 };
776 #endif
777 
784  struct esp_hdr hdr;
785 };
786 
788 #ifndef __cplusplus
790  .hdr = {
791  .spi = 0xffffffff,
792  },
793 };
794 #endif
795 
808  uint8_t vni[3];
809  uint8_t rsvd1;
810 };
811 
813 #ifndef __cplusplus
815  .vni = "\xff\xff\xff",
816 };
817 #endif
818 
854  const void *spec;
855  const void *last;
856  const void *mask;
857 };
858 
897 
907 
917 
927 
937 
944 
953 
965 
975 
984 
992 
1000 
1008 
1016 };
1017 
1029  uint32_t id;
1030 };
1031 
1040  uint16_t index;
1041 };
1042 
1049  uint32_t reset:1;
1050  uint32_t hits_set:1;
1051  uint32_t bytes_set:1;
1052  uint32_t reserved:29;
1053  uint64_t hits;
1054  uint64_t bytes;
1055 };
1056 
1068  uint16_t index;
1069 };
1070 
1084  const struct rte_eth_rss_conf *rss_conf;
1085  uint16_t num;
1086  uint16_t queue[];
1087 };
1088 
1103  uint32_t original:1;
1104  uint32_t reserved:31;
1105  uint32_t id;
1106 };
1107 
1119  uint32_t mtr_id;
1120 };
1121 
1151 };
1152 
1162  const void *conf;
1163 };
1164 
1171 struct rte_flow;
1172 
1192 };
1193 
1207  const void *cause;
1208  const char *message;
1209 };
1210 
1263 int
1264 rte_flow_validate(uint16_t port_id,
1265  const struct rte_flow_attr *attr,
1266  const struct rte_flow_item pattern[],
1267  const struct rte_flow_action actions[],
1268  struct rte_flow_error *error);
1269 
1290 struct rte_flow *
1291 rte_flow_create(uint16_t port_id,
1292  const struct rte_flow_attr *attr,
1293  const struct rte_flow_item pattern[],
1294  const struct rte_flow_action actions[],
1295  struct rte_flow_error *error);
1296 
1317 int
1318 rte_flow_destroy(uint16_t port_id,
1319  struct rte_flow *flow,
1320  struct rte_flow_error *error);
1321 
1338 int
1339 rte_flow_flush(uint16_t port_id,
1340  struct rte_flow_error *error);
1341 
1366 int
1367 rte_flow_query(uint16_t port_id,
1368  struct rte_flow *flow,
1369  enum rte_flow_action_type action,
1370  void *data,
1371  struct rte_flow_error *error);
1372 
1414 int
1415 rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
1416 
1434 int
1435 rte_flow_error_set(struct rte_flow_error *error,
1436  int code,
1437  enum rte_flow_error_type type,
1438  const void *cause,
1439  const char *message);
1440 
1448  size_t size;
1452  uint8_t data[];
1453 };
1454 
1475 size_t
1476 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
1477  const struct rte_flow_attr *attr,
1478  const struct rte_flow_item *items,
1479  const struct rte_flow_action *actions);
1480 
1481 #ifdef __cplusplus
1482 }
1483 #endif
1484 
1485 #endif /* RTE_FLOW_H_ */
uint32_t reserved
Definition: rte_flow.h:73
rte_be16_t c_rsvd0_ver
Definition: rte_flow.h:714
rte_be16_t ver_opt_len_o_c_rsvd0
Definition: rte_flow.h:806
uint8_t pattern[]
Definition: rte_flow.h:437
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:527
rte_be16_t epcp_edei_in_ecid_b
Definition: rte_flow.h:645
rte_be16_t protocol
Definition: rte_flow.h:807
uint32_t num
Definition: rte_flow.h:342
uint32_t rte_be32_t
uint32_t src_addr
Definition: rte_ip.h:40
uint32_t original
Definition: rte_flow.h:1103
struct ether_addr src
Definition: rte_flow.h:459
uint32_t group
Definition: rte_flow.h:69
static const struct rte_flow_item_gre rte_flow_item_gre_mask
Definition: rte_flow.h:720
struct rte_flow_attr attr
Definition: rte_flow.h:1449
rte_be16_t msg_len
Definition: rte_flow.h:767
static const struct rte_flow_item_gtp rte_flow_item_gtp_mask
Definition: rte_flow.h:773
static const struct rte_flow_item_icmp rte_flow_item_icmp_mask
Definition: rte_flow.h:550
struct tcp_hdr hdr
Definition: rte_flow.h:583
static const struct rte_flow_item_geneve rte_flow_item_geneve_mask
Definition: rte_flow.h:814
static const struct rte_flow_item_sctp rte_flow_item_sctp_mask
Definition: rte_flow.h:607
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:347
static const struct rte_flow_item_esp rte_flow_item_esp_mask
Definition: rte_flow.h:789
struct sctp_hdr hdr
Definition: rte_flow.h:602
uint8_t v_pt_rsv_flags
Definition: rte_flow.h:765
rte_be16_t protocol
Definition: rte_flow.h:672
uint32_t reserved
Definition: rte_flow.h:433
struct rte_flow_action * actions
Definition: rte_flow.h:1451
uint8_t data[]
Definition: rte_flow.h:1452
static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask
Definition: rte_flow.h:629
struct udp_hdr hdr
Definition: rte_flow.h:564
struct icmp_hdr hdr
Definition: rte_flow.h:545
static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask
Definition: rte_flow.h:679
rte_be32_t spi
Definition: rte_esp.h:24
const void * mask
Definition: rte_flow.h:856
rte_be16_t type
Definition: rte_flow.h:460
enum rte_flow_error_type type
Definition: rte_flow.h:1206
const void * cause
Definition: rte_flow.h:1207
struct ipv6_hdr hdr
Definition: rte_flow.h:522
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:569
rte_flow_error_type
Definition: rte_flow.h:1179
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:640
uint32_t id
Definition: rte_flow.h:371
uint32_t search
Definition: rte_flow.h:432
uint8_t addr_bytes[ETHER_ADDR_LEN]
Definition: rte_ether.h:58
rte_be16_t rsvd_grp_ecid_b
Definition: rte_flow.h:647
uint32_t index
Definition: rte_flow.h:402
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:442
uint16_t limit
Definition: rte_flow.h:435
uint8_t vni[3]
Definition: rte_flow.h:808
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:699
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:1162
const char * message
Definition: rte_flow.h:1208
uint16_t length
Definition: rte_flow.h:436
const void * last
Definition: rte_flow.h:855
rte_be32_t teid
Definition: rte_flow.h:768
int rte_flow_destroy(uint16_t port_id, struct rte_flow *flow, struct rte_flow_error *error)
uint32_t ingress
Definition: rte_flow.h:71
enum rte_flow_item_type type
Definition: rte_flow.h:853
rte_be16_t tci
Definition: rte_flow.h:482
struct ipv4_hdr hdr
Definition: rte_flow.h:501
static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask
Definition: rte_flow.h:506
size_t size
Definition: rte_flow.h:1448
rte_be16_t c_k_s_rsvd0_ver
Definition: rte_flow.h:671
struct rte_flow_item * items
Definition: rte_flow.h:1450
rte_flow_action_type
Definition: rte_flow.h:887
rte_be16_t tpid
Definition: rte_flow.h:481
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:1084
const void * spec
Definition: rte_flow.h:854
uint8_t label_tc_s[3]
Definition: rte_flow.h:693
uint16_t queue[]
Definition: rte_flow.h:1086
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:465
struct esp_hdr hdr
Definition: rte_flow.h:784
uint16_t rte_be16_t
uint16_t src_port
Definition: rte_tcp.h:27
struct ether_addr dst
Definition: rte_flow.h:458
uint32_t reserved
Definition: rte_flow.h:1104
uint32_t priority
Definition: rte_flow.h:70
static const struct rte_flow_item_port rte_flow_item_port_mask
Definition: rte_flow.h:407
static const struct rte_flow_item_vf rte_flow_item_vf_mask
Definition: rte_flow.h:376
rte_be16_t protocol
Definition: rte_flow.h:715
uint8_t tni[3]
Definition: rte_flow.h:673
static const struct rte_flow_item_vlan rte_flow_item_vlan_mask
Definition: rte_flow.h:487
uint8_t msg_type
Definition: rte_flow.h:766
uint32_t egress
Definition: rte_flow.h:72
static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask
Definition: rte_flow.h:654
static const struct rte_flow_item_tcp rte_flow_item_tcp_mask
Definition: rte_flow.h:588
static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask
Definition: rte_flow.h:748
enum rte_flow_action_type type
Definition: rte_flow.h:1161
uint8_t rsvd0[3]
Definition: rte_flow.h:622
rte_flow_item_type
Definition: rte_flow.h:94
uint32_t relative
Definition: rte_flow.h:431
uint8_t vni[3]
Definition: rte_flow.h:623
int32_t offset
Definition: rte_flow.h:434