DPDK  17.02.1
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 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
92 struct rte_flow_attr {
93  uint32_t group;
94  uint32_t priority;
95  uint32_t ingress:1;
96  uint32_t egress:1;
97  uint32_t reserved:30;
98 };
99 
128 
138 
148 
156 
171 
186 
201 
208 
215 
222 
229 
236 
243 
250 
257 
264 
271 
278 
285 };
286 
299  uint32_t num;
300 };
301 
304  .num = 0x00000000,
305 };
306 
326  uint32_t id;
327 };
328 
331  .id = 0x00000000,
332 };
333 
355  uint32_t index;
356 };
357 
360  .index = 0x00000000,
361 };
362 
382  uint32_t relative:1;
383  uint32_t search:1;
384  uint32_t reserved:30;
385  int32_t offset;
386  uint16_t limit;
387  uint16_t length;
388  uint8_t pattern[];
389 };
390 
393  .relative = 1,
394  .search = 1,
395  .reserved = 0x3fffffff,
396  .offset = 0xffffffff,
397  .limit = 0xffff,
398  .length = 0xffff,
399 };
400 
407  struct ether_addr dst;
408  struct ether_addr src;
409  uint16_t type;
410 };
411 
414  .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
415  .src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
416  .type = 0x0000,
417 };
418 
428  uint16_t tpid;
429  uint16_t tci;
430 };
431 
434  .tpid = 0x0000,
435  .tci = 0xffff,
436 };
437 
446  struct ipv4_hdr hdr;
447 };
448 
451  .hdr = {
452  .src_addr = 0xffffffff,
453  .dst_addr = 0xffffffff,
454  },
455 };
456 
465  struct ipv6_hdr hdr;
466 };
467 
470  .hdr = {
471  .src_addr =
472  "\xff\xff\xff\xff\xff\xff\xff\xff"
473  "\xff\xff\xff\xff\xff\xff\xff\xff",
474  .dst_addr =
475  "\xff\xff\xff\xff\xff\xff\xff\xff"
476  "\xff\xff\xff\xff\xff\xff\xff\xff",
477  },
478 };
479 
486  struct icmp_hdr hdr;
487 };
488 
491  .hdr = {
492  .icmp_type = 0xff,
493  .icmp_code = 0xff,
494  },
495 };
496 
503  struct udp_hdr hdr;
504 };
505 
508  .hdr = {
509  .src_port = 0xffff,
510  .dst_port = 0xffff,
511  },
512 };
513 
520  struct tcp_hdr hdr;
521 };
522 
525  .hdr = {
526  .src_port = 0xffff,
527  .dst_port = 0xffff,
528  },
529 };
530 
537  struct sctp_hdr hdr;
538 };
539 
542  .hdr = {
543  .src_port = 0xffff,
544  .dst_port = 0xffff,
545  },
546 };
547 
554  uint8_t flags;
555  uint8_t rsvd0[3];
556  uint8_t vni[3];
557  uint8_t rsvd1;
558 };
559 
562  .vni = "\xff\xff\xff",
563 };
564 
571  uint16_t tpid;
578  uint16_t rsvd_grp_ecid_b;
579  uint8_t in_ecid_e;
580  uint8_t ecid_e;
581 };
582 
595  uint16_t c_k_s_rsvd0_ver;
596  uint16_t protocol;
597  uint8_t tni[3];
598  uint8_t flow_id;
599 };
600 
636  const void *spec;
637  const void *last;
638  const void *mask;
639 };
640 
679 
689 
699 
709 
719 
726 
735 
747 
757 
766 
774 
782 };
783 
795  uint32_t id;
796 };
797 
806  uint16_t index;
807 };
808 
815  uint32_t reset:1;
816  uint32_t hits_set:1;
817  uint32_t bytes_set:1;
818  uint32_t reserved:29;
819  uint64_t hits;
820  uint64_t bytes;
821 };
822 
834  uint16_t index;
835 };
836 
850  const struct rte_eth_rss_conf *rss_conf;
851  uint16_t num;
852  uint16_t queue[];
853 };
854 
869  uint32_t original:1;
870  uint32_t reserved:31;
871  uint32_t id;
872 };
873 
883  const void *conf;
884 };
885 
892 struct rte_flow;
893 
913 };
914 
928  const void *cause;
929  const char *message;
930 };
931 
976 int
977 rte_flow_validate(uint8_t port_id,
978  const struct rte_flow_attr *attr,
979  const struct rte_flow_item pattern[],
980  const struct rte_flow_action actions[],
981  struct rte_flow_error *error);
982 
1003 struct rte_flow *
1004 rte_flow_create(uint8_t port_id,
1005  const struct rte_flow_attr *attr,
1006  const struct rte_flow_item pattern[],
1007  const struct rte_flow_action actions[],
1008  struct rte_flow_error *error);
1009 
1030 int
1031 rte_flow_destroy(uint8_t port_id,
1032  struct rte_flow *flow,
1033  struct rte_flow_error *error);
1034 
1051 int
1052 rte_flow_flush(uint8_t port_id,
1053  struct rte_flow_error *error);
1054 
1079 int
1080 rte_flow_query(uint8_t port_id,
1081  struct rte_flow *flow,
1082  enum rte_flow_action_type action,
1083  void *data,
1084  struct rte_flow_error *error);
1085 
1086 #ifdef __cplusplus
1087 }
1088 #endif
1089 
1090 #endif /* RTE_FLOW_H_ */