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_ */