DPDK  17.08.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 
312 };
313 
326  uint32_t num;
327 };
328 
330 #ifndef __cplusplus
332  .num = 0x00000000,
333 };
334 #endif
335 
355  uint32_t id;
356 };
357 
359 #ifndef __cplusplus
361  .id = 0x00000000,
362 };
363 #endif
364 
386  uint32_t index;
387 };
388 
390 #ifndef __cplusplus
392  .index = 0x00000000,
393 };
394 #endif
395 
415  uint32_t relative:1;
416  uint32_t search:1;
417  uint32_t reserved:30;
418  int32_t offset;
419  uint16_t limit;
420  uint16_t length;
421  uint8_t pattern[];
422 };
423 
425 #ifndef __cplusplus
427  .relative = 1,
428  .search = 1,
429  .reserved = 0x3fffffff,
430  .offset = 0xffffffff,
431  .limit = 0xffff,
432  .length = 0xffff,
433 };
434 #endif
435 
442  struct ether_addr dst;
443  struct ether_addr src;
445 };
446 
448 #ifndef __cplusplus
450  .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
451  .src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
452  .type = RTE_BE16(0x0000),
453 };
454 #endif
455 
467 };
468 
470 #ifndef __cplusplus
472  .tpid = RTE_BE16(0x0000),
473  .tci = RTE_BE16(0xffff),
474 };
475 #endif
476 
485  struct ipv4_hdr hdr;
486 };
487 
489 #ifndef __cplusplus
491  .hdr = {
492  .src_addr = RTE_BE32(0xffffffff),
493  .dst_addr = RTE_BE32(0xffffffff),
494  },
495 };
496 #endif
497 
506  struct ipv6_hdr hdr;
507 };
508 
510 #ifndef __cplusplus
512  .hdr = {
513  .src_addr =
514  "\xff\xff\xff\xff\xff\xff\xff\xff"
515  "\xff\xff\xff\xff\xff\xff\xff\xff",
516  .dst_addr =
517  "\xff\xff\xff\xff\xff\xff\xff\xff"
518  "\xff\xff\xff\xff\xff\xff\xff\xff",
519  },
520 };
521 #endif
522 
529  struct icmp_hdr hdr;
530 };
531 
533 #ifndef __cplusplus
535  .hdr = {
536  .icmp_type = 0xff,
537  .icmp_code = 0xff,
538  },
539 };
540 #endif
541 
548  struct udp_hdr hdr;
549 };
550 
552 #ifndef __cplusplus
554  .hdr = {
555  .src_port = RTE_BE16(0xffff),
556  .dst_port = RTE_BE16(0xffff),
557  },
558 };
559 #endif
560 
567  struct tcp_hdr hdr;
568 };
569 
571 #ifndef __cplusplus
573  .hdr = {
574  .src_port = RTE_BE16(0xffff),
575  .dst_port = RTE_BE16(0xffff),
576  },
577 };
578 #endif
579 
586  struct sctp_hdr hdr;
587 };
588 
590 #ifndef __cplusplus
592  .hdr = {
593  .src_port = RTE_BE16(0xffff),
594  .dst_port = RTE_BE16(0xffff),
595  },
596 };
597 #endif
598 
605  uint8_t flags;
606  uint8_t rsvd0[3];
607  uint8_t vni[3];
608  uint8_t rsvd1;
609 };
610 
612 #ifndef __cplusplus
614  .vni = "\xff\xff\xff",
615 };
616 #endif
617 
632  uint8_t in_ecid_e;
633  uint8_t ecid_e;
634 };
635 
637 #ifndef __cplusplus
639  .rsvd_grp_ecid_b = RTE_BE16(0x3fff),
640 };
641 #endif
642 
657  uint8_t tni[3];
658  uint8_t flow_id;
659 };
660 
662 #ifndef __cplusplus
664  .tni = "\xff\xff\xff",
665 };
666 #endif
667 
677  uint8_t label_tc_s[3];
678  uint8_t ttl;
679 };
680 
682 #ifndef __cplusplus
684  .label_tc_s = "\xff\xff\xf0",
685 };
686 #endif
687 
700 };
701 
703 #ifndef __cplusplus
705  .protocol = RTE_BE16(0xffff),
706 };
707 #endif
708 
727  uint32_t thresh;
728 };
729 
731 #ifndef __cplusplus
733  .thresh = 0xffffffff,
734 };
735 #endif
736 
772  const void *spec;
773  const void *last;
774  const void *mask;
775 };
776 
815 
825 
835 
845 
855 
862 
871 
883 
893 
902 
910 
918 };
919 
931  uint32_t id;
932 };
933 
942  uint16_t index;
943 };
944 
951  uint32_t reset:1;
952  uint32_t hits_set:1;
953  uint32_t bytes_set:1;
954  uint32_t reserved:29;
955  uint64_t hits;
956  uint64_t bytes;
957 };
958 
970  uint16_t index;
971 };
972 
986  const struct rte_eth_rss_conf *rss_conf;
987  uint16_t num;
988  uint16_t queue[];
989 };
990 
1005  uint32_t original:1;
1006  uint32_t reserved:31;
1007  uint32_t id;
1008 };
1009 
1019  const void *conf;
1020 };
1021 
1028 struct rte_flow;
1029 
1049 };
1050 
1064  const void *cause;
1065  const char *message;
1066 };
1067 
1118 int
1119 rte_flow_validate(uint8_t port_id,
1120  const struct rte_flow_attr *attr,
1121  const struct rte_flow_item pattern[],
1122  const struct rte_flow_action actions[],
1123  struct rte_flow_error *error);
1124 
1145 struct rte_flow *
1146 rte_flow_create(uint8_t port_id,
1147  const struct rte_flow_attr *attr,
1148  const struct rte_flow_item pattern[],
1149  const struct rte_flow_action actions[],
1150  struct rte_flow_error *error);
1151 
1172 int
1173 rte_flow_destroy(uint8_t port_id,
1174  struct rte_flow *flow,
1175  struct rte_flow_error *error);
1176 
1193 int
1194 rte_flow_flush(uint8_t port_id,
1195  struct rte_flow_error *error);
1196 
1221 int
1222 rte_flow_query(uint8_t port_id,
1223  struct rte_flow *flow,
1224  enum rte_flow_action_type action,
1225  void *data,
1226  struct rte_flow_error *error);
1227 
1269 int
1270 rte_flow_isolate(uint8_t port_id, int set, struct rte_flow_error *error);
1271 
1279  size_t size;
1283  uint8_t data[];
1284 };
1285 
1306 size_t
1307 rte_flow_copy(struct rte_flow_desc *fd, size_t len,
1308  const struct rte_flow_attr *attr,
1309  const struct rte_flow_item *items,
1310  const struct rte_flow_action *actions);
1311 
1312 #ifdef __cplusplus
1313 }
1314 #endif
1315 
1316 #endif /* RTE_FLOW_H_ */