DPDK  17.05.2
rte_flow.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright 2016 6WIND S.A.
5  * Copyright 2016 Mellanox.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of 6WIND S.A. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef RTE_FLOW_H_
35 #define RTE_FLOW_H_
36 
45 #include <rte_arp.h>
46 #include <rte_ether.h>
47 #include <rte_icmp.h>
48 #include <rte_ip.h>
49 #include <rte_sctp.h>
50 #include <rte_tcp.h>
51 #include <rte_udp.h>
52 #include <rte_byteorder.h>
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
93 struct rte_flow_attr {
94  uint32_t group;
95  uint32_t priority;
96  uint32_t ingress:1;
97  uint32_t egress:1;
98  uint32_t reserved:30;
99 };
100 
129 
139 
149 
157 
172 
187 
202 
209 
216 
223 
230 
237 
244 
251 
258 
265 
272 
279 
286 
293 
300 };
301 
314  uint32_t num;
315 };
316 
318 #ifndef __cplusplus
320  .num = 0x00000000,
321 };
322 #endif
323 
343  uint32_t id;
344 };
345 
347 #ifndef __cplusplus
349  .id = 0x00000000,
350 };
351 #endif
352 
374  uint32_t index;
375 };
376 
378 #ifndef __cplusplus
380  .index = 0x00000000,
381 };
382 #endif
383 
403  uint32_t relative:1;
404  uint32_t search:1;
405  uint32_t reserved:30;
406  int32_t offset;
407  uint16_t limit;
408  uint16_t length;
409  uint8_t pattern[];
410 };
411 
413 #ifndef __cplusplus
415  .relative = 1,
416  .search = 1,
417  .reserved = 0x3fffffff,
418  .offset = 0xffffffff,
419  .limit = 0xffff,
420  .length = 0xffff,
421 };
422 #endif
423 
430  struct ether_addr dst;
431  struct ether_addr src;
432  uint16_t type;
433 };
434 
436 #ifndef __cplusplus
438  .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
439  .src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
440  .type = 0x0000,
441 };
442 #endif
443 
453  uint16_t tpid;
454  uint16_t tci;
455 };
456 
458 #ifndef __cplusplus
460  .tpid = 0x0000,
461  .tci = 0xffff,
462 };
463 #endif
464 
473  struct ipv4_hdr hdr;
474 };
475 
477 #ifndef __cplusplus
479  .hdr = {
480  .src_addr = 0xffffffff,
481  .dst_addr = 0xffffffff,
482  },
483 };
484 #endif
485 
494  struct ipv6_hdr hdr;
495 };
496 
498 #ifndef __cplusplus
500  .hdr = {
501  .src_addr =
502  "\xff\xff\xff\xff\xff\xff\xff\xff"
503  "\xff\xff\xff\xff\xff\xff\xff\xff",
504  .dst_addr =
505  "\xff\xff\xff\xff\xff\xff\xff\xff"
506  "\xff\xff\xff\xff\xff\xff\xff\xff",
507  },
508 };
509 #endif
510 
517  struct icmp_hdr hdr;
518 };
519 
521 #ifndef __cplusplus
523  .hdr = {
524  .icmp_type = 0xff,
525  .icmp_code = 0xff,
526  },
527 };
528 #endif
529 
536  struct udp_hdr hdr;
537 };
538 
540 #ifndef __cplusplus
542  .hdr = {
543  .src_port = 0xffff,
544  .dst_port = 0xffff,
545  },
546 };
547 #endif
548 
555  struct tcp_hdr hdr;
556 };
557 
559 #ifndef __cplusplus
561  .hdr = {
562  .src_port = 0xffff,
563  .dst_port = 0xffff,
564  },
565 };
566 #endif
567 
574  struct sctp_hdr hdr;
575 };
576 
578 #ifndef __cplusplus
580  .hdr = {
581  .src_port = 0xffff,
582  .dst_port = 0xffff,
583  },
584 };
585 #endif
586 
593  uint8_t flags;
594  uint8_t rsvd0[3];
595  uint8_t vni[3];
596  uint8_t rsvd1;
597 };
598 
600 #ifndef __cplusplus
602  .vni = "\xff\xff\xff",
603 };
604 #endif
605 
612  uint16_t tpid;
619  uint16_t rsvd_grp_ecid_b;
620  uint8_t in_ecid_e;
621  uint8_t ecid_e;
622 };
623 
625 #ifndef __cplusplus
627 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
628  .rsvd_grp_ecid_b = 0x3fff,
629 #elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
630  .rsvd_grp_ecid_b = 0xff3f,
631 #else
632 #error Unsupported endianness.
633 #endif
634 };
635 #endif
636 
649  uint16_t c_k_s_rsvd0_ver;
650  uint16_t protocol;
651  uint8_t tni[3];
652  uint8_t flow_id;
653 };
654 
656 #ifndef __cplusplus
658  .tni = "\xff\xff\xff",
659 };
660 #endif
661 
671  uint8_t label_tc_s[3];
672  uint8_t ttl;
673 };
674 
676 #ifndef __cplusplus
678  .label_tc_s = "\xff\xff\xf0",
679 };
680 #endif
681 
692  uint16_t c_rsvd0_ver;
693  uint16_t protocol;
694 };
695 
697 #ifndef __cplusplus
699  .protocol = 0xffff,
700 };
701 #endif
702 
738  const void *spec;
739  const void *last;
740  const void *mask;
741 };
742 
781 
791 
801 
811 
821 
828 
837 
849 
859 
868 
876 
884 };
885 
897  uint32_t id;
898 };
899 
908  uint16_t index;
909 };
910 
917  uint32_t reset:1;
918  uint32_t hits_set:1;
919  uint32_t bytes_set:1;
920  uint32_t reserved:29;
921  uint64_t hits;
922  uint64_t bytes;
923 };
924 
936  uint16_t index;
937 };
938 
952  const struct rte_eth_rss_conf *rss_conf;
953  uint16_t num;
954  uint16_t queue[];
955 };
956 
971  uint32_t original:1;
972  uint32_t reserved:31;
973  uint32_t id;
974 };
975 
985  const void *conf;
986 };
987 
994 struct rte_flow;
995 
1015 };
1016 
1030  const void *cause;
1031  const char *message;
1032 };
1033 
1084 int
1085 rte_flow_validate(uint8_t port_id,
1086  const struct rte_flow_attr *attr,
1087  const struct rte_flow_item pattern[],
1088  const struct rte_flow_action actions[],
1089  struct rte_flow_error *error);
1090 
1111 struct rte_flow *
1112 rte_flow_create(uint8_t port_id,
1113  const struct rte_flow_attr *attr,
1114  const struct rte_flow_item pattern[],
1115  const struct rte_flow_action actions[],
1116  struct rte_flow_error *error);
1117 
1138 int
1139 rte_flow_destroy(uint8_t port_id,
1140  struct rte_flow *flow,
1141  struct rte_flow_error *error);
1142 
1159 int
1160 rte_flow_flush(uint8_t port_id,
1161  struct rte_flow_error *error);
1162 
1187 int
1188 rte_flow_query(uint8_t port_id,
1189  struct rte_flow *flow,
1190  enum rte_flow_action_type action,
1191  void *data,
1192  struct rte_flow_error *error);
1193 
1194 #ifdef __cplusplus
1195 }
1196 #endif
1197 
1198 #endif /* RTE_FLOW_H_ */