DPDK
17.05.2
Main Page
Related Pages
Data Structures
Files
Examples
File List
Globals
lib
librte_ether
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
119
enum
rte_flow_item_type
{
128
RTE_FLOW_ITEM_TYPE_END
,
129
138
RTE_FLOW_ITEM_TYPE_VOID
,
139
148
RTE_FLOW_ITEM_TYPE_INVERT
,
149
156
RTE_FLOW_ITEM_TYPE_ANY
,
157
171
RTE_FLOW_ITEM_TYPE_PF
,
172
186
RTE_FLOW_ITEM_TYPE_VF
,
187
201
RTE_FLOW_ITEM_TYPE_PORT
,
202
208
RTE_FLOW_ITEM_TYPE_RAW
,
209
215
RTE_FLOW_ITEM_TYPE_ETH
,
216
222
RTE_FLOW_ITEM_TYPE_VLAN
,
223
229
RTE_FLOW_ITEM_TYPE_IPV4
,
230
236
RTE_FLOW_ITEM_TYPE_IPV6
,
237
243
RTE_FLOW_ITEM_TYPE_ICMP
,
244
250
RTE_FLOW_ITEM_TYPE_UDP
,
251
257
RTE_FLOW_ITEM_TYPE_TCP
,
258
264
RTE_FLOW_ITEM_TYPE_SCTP
,
265
271
RTE_FLOW_ITEM_TYPE_VXLAN
,
272
278
RTE_FLOW_ITEM_TYPE_E_TAG
,
279
285
RTE_FLOW_ITEM_TYPE_NVGRE
,
286
292
RTE_FLOW_ITEM_TYPE_MPLS
,
293
299
RTE_FLOW_ITEM_TYPE_GRE
,
300
};
301
313
struct
rte_flow_item_any
{
314
uint32_t
num
;
315
};
316
318
#ifndef __cplusplus
319
static
const
struct
rte_flow_item_any
rte_flow_item_any_mask
= {
320
.
num
= 0x00000000,
321
};
322
#endif
323
342
struct
rte_flow_item_vf
{
343
uint32_t
id
;
344
};
345
347
#ifndef __cplusplus
348
static
const
struct
rte_flow_item_vf
rte_flow_item_vf_mask
= {
349
.
id
= 0x00000000,
350
};
351
#endif
352
373
struct
rte_flow_item_port
{
374
uint32_t
index
;
375
};
376
378
#ifndef __cplusplus
379
static
const
struct
rte_flow_item_port
rte_flow_item_port_mask
= {
380
.
index
= 0x00000000,
381
};
382
#endif
383
402
struct
rte_flow_item_raw
{
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
414
static
const
struct
rte_flow_item_raw
rte_flow_item_raw_mask
= {
415
.
relative
= 1,
416
.search = 1,
417
.reserved = 0x3fffffff,
418
.offset = 0xffffffff,
419
.limit = 0xffff,
420
.length = 0xffff,
421
};
422
#endif
423
429
struct
rte_flow_item_eth
{
430
struct
ether_addr
dst
;
431
struct
ether_addr
src
;
432
uint16_t
type
;
433
};
434
436
#ifndef __cplusplus
437
static
const
struct
rte_flow_item_eth
rte_flow_item_eth_mask
= {
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
452
struct
rte_flow_item_vlan
{
453
uint16_t
tpid
;
454
uint16_t
tci
;
455
};
456
458
#ifndef __cplusplus
459
static
const
struct
rte_flow_item_vlan
rte_flow_item_vlan_mask
= {
460
.
tpid
= 0x0000,
461
.tci = 0xffff,
462
};
463
#endif
464
472
struct
rte_flow_item_ipv4
{
473
struct
ipv4_hdr
hdr
;
474
};
475
477
#ifndef __cplusplus
478
static
const
struct
rte_flow_item_ipv4
rte_flow_item_ipv4_mask
= {
479
.
hdr
= {
480
.
src_addr
= 0xffffffff,
481
.dst_addr = 0xffffffff,
482
},
483
};
484
#endif
485
493
struct
rte_flow_item_ipv6
{
494
struct
ipv6_hdr
hdr
;
495
};
496
498
#ifndef __cplusplus
499
static
const
struct
rte_flow_item_ipv6
rte_flow_item_ipv6_mask
= {
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
516
struct
rte_flow_item_icmp
{
517
struct
icmp_hdr
hdr
;
518
};
519
521
#ifndef __cplusplus
522
static
const
struct
rte_flow_item_icmp
rte_flow_item_icmp_mask
= {
523
.
hdr
= {
524
.icmp_type = 0xff,
525
.icmp_code = 0xff,
526
},
527
};
528
#endif
529
535
struct
rte_flow_item_udp
{
536
struct
udp_hdr
hdr
;
537
};
538
540
#ifndef __cplusplus
541
static
const
struct
rte_flow_item_udp
rte_flow_item_udp_mask
= {
542
.
hdr
= {
543
.
src_port
= 0xffff,
544
.dst_port = 0xffff,
545
},
546
};
547
#endif
548
554
struct
rte_flow_item_tcp
{
555
struct
tcp_hdr
hdr
;
556
};
557
559
#ifndef __cplusplus
560
static
const
struct
rte_flow_item_tcp
rte_flow_item_tcp_mask
= {
561
.
hdr
= {
562
.
src_port
= 0xffff,
563
.dst_port = 0xffff,
564
},
565
};
566
#endif
567
573
struct
rte_flow_item_sctp
{
574
struct
sctp_hdr
hdr
;
575
};
576
578
#ifndef __cplusplus
579
static
const
struct
rte_flow_item_sctp
rte_flow_item_sctp_mask
= {
580
.
hdr
= {
581
.
src_port
= 0xffff,
582
.dst_port = 0xffff,
583
},
584
};
585
#endif
586
592
struct
rte_flow_item_vxlan
{
593
uint8_t
flags
;
594
uint8_t
rsvd0
[3];
595
uint8_t
vni
[3];
596
uint8_t
rsvd1
;
597
};
598
600
#ifndef __cplusplus
601
static
const
struct
rte_flow_item_vxlan
rte_flow_item_vxlan_mask
= {
602
.
vni
=
"\xff\xff\xff"
,
603
};
604
#endif
605
611
struct
rte_flow_item_e_tag
{
612
uint16_t
tpid
;
617
uint16_t
epcp_edei_in_ecid_b
;
619
uint16_t
rsvd_grp_ecid_b
;
620
uint8_t
in_ecid_e
;
621
uint8_t
ecid_e
;
622
};
623
625
#ifndef __cplusplus
626
static
const
struct
rte_flow_item_e_tag
rte_flow_item_e_tag_mask
= {
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
642
struct
rte_flow_item_nvgre
{
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
657
static
const
struct
rte_flow_item_nvgre
rte_flow_item_nvgre_mask
= {
658
.
tni
=
"\xff\xff\xff"
,
659
};
660
#endif
661
667
struct
rte_flow_item_mpls
{
671
uint8_t
label_tc_s
[3];
672
uint8_t ttl;
673
};
674
676
#ifndef __cplusplus
677
static
const
struct
rte_flow_item_mpls
rte_flow_item_mpls_mask
= {
678
.
label_tc_s
=
"\xff\xff\xf0"
,
679
};
680
#endif
681
687
struct
rte_flow_item_gre
{
692
uint16_t
c_rsvd0_ver
;
693
uint16_t
protocol
;
694
};
695
697
#ifndef __cplusplus
698
static
const
struct
rte_flow_item_gre
rte_flow_item_gre_mask
= {
699
.
protocol
= 0xffff,
700
};
701
#endif
702
736
struct
rte_flow_item
{
737
enum
rte_flow_item_type
type
;
738
const
void
*
spec
;
739
const
void
*
last
;
740
const
void
*
mask
;
741
};
742
771
enum
rte_flow_action_type
{
780
RTE_FLOW_ACTION_TYPE_END
,
781
790
RTE_FLOW_ACTION_TYPE_VOID
,
791
800
RTE_FLOW_ACTION_TYPE_PASSTHRU
,
801
810
RTE_FLOW_ACTION_TYPE_MARK
,
811
820
RTE_FLOW_ACTION_TYPE_FLAG
,
821
827
RTE_FLOW_ACTION_TYPE_QUEUE
,
828
836
RTE_FLOW_ACTION_TYPE_DROP
,
837
848
RTE_FLOW_ACTION_TYPE_COUNT
,
849
858
RTE_FLOW_ACTION_TYPE_DUP
,
859
867
RTE_FLOW_ACTION_TYPE_RSS
,
868
875
RTE_FLOW_ACTION_TYPE_PF
,
876
883
RTE_FLOW_ACTION_TYPE_VF
,
884
};
885
896
struct
rte_flow_action_mark
{
897
uint32_t
id
;
898
};
899
907
struct
rte_flow_action_queue
{
908
uint16_t
index
;
909
};
910
916
struct
rte_flow_query_count
{
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
935
struct
rte_flow_action_dup
{
936
uint16_t
index
;
937
};
938
951
struct
rte_flow_action_rss
{
952
const
struct
rte_eth_rss_conf
*
rss_conf
;
953
uint16_t
num
;
954
uint16_t
queue
[];
955
};
956
970
struct
rte_flow_action_vf
{
971
uint32_t
original
:1;
972
uint32_t
reserved
:31;
973
uint32_t
id
;
974
};
975
983
struct
rte_flow_action
{
984
enum
rte_flow_action_type
type
;
985
const
void
*
conf
;
986
};
987
994
struct
rte_flow;
995
1002
enum
rte_flow_error_type
{
1003
RTE_FLOW_ERROR_TYPE_NONE
,
1004
RTE_FLOW_ERROR_TYPE_UNSPECIFIED
,
1005
RTE_FLOW_ERROR_TYPE_HANDLE
,
1006
RTE_FLOW_ERROR_TYPE_ATTR_GROUP
,
1007
RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY
,
1008
RTE_FLOW_ERROR_TYPE_ATTR_INGRESS
,
1009
RTE_FLOW_ERROR_TYPE_ATTR_EGRESS
,
1010
RTE_FLOW_ERROR_TYPE_ATTR
,
1011
RTE_FLOW_ERROR_TYPE_ITEM_NUM
,
1012
RTE_FLOW_ERROR_TYPE_ITEM
,
1013
RTE_FLOW_ERROR_TYPE_ACTION_NUM
,
1014
RTE_FLOW_ERROR_TYPE_ACTION
,
1015
};
1016
1028
struct
rte_flow_error
{
1029
enum
rte_flow_error_type
type
;
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_ */
Generated by
1.8.1.2