DPDK
17.08.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
311
RTE_FLOW_ITEM_TYPE_FUZZY
,
312
};
313
325
struct
rte_flow_item_any
{
326
uint32_t
num
;
327
};
328
330
#ifndef __cplusplus
331
static
const
struct
rte_flow_item_any
rte_flow_item_any_mask
= {
332
.
num
= 0x00000000,
333
};
334
#endif
335
354
struct
rte_flow_item_vf
{
355
uint32_t
id
;
356
};
357
359
#ifndef __cplusplus
360
static
const
struct
rte_flow_item_vf
rte_flow_item_vf_mask
= {
361
.
id
= 0x00000000,
362
};
363
#endif
364
385
struct
rte_flow_item_port
{
386
uint32_t
index
;
387
};
388
390
#ifndef __cplusplus
391
static
const
struct
rte_flow_item_port
rte_flow_item_port_mask
= {
392
.
index
= 0x00000000,
393
};
394
#endif
395
414
struct
rte_flow_item_raw
{
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
426
static
const
struct
rte_flow_item_raw
rte_flow_item_raw_mask
= {
427
.
relative
= 1,
428
.search = 1,
429
.reserved = 0x3fffffff,
430
.offset = 0xffffffff,
431
.limit = 0xffff,
432
.length = 0xffff,
433
};
434
#endif
435
441
struct
rte_flow_item_eth
{
442
struct
ether_addr
dst
;
443
struct
ether_addr
src
;
444
rte_be16_t
type
;
445
};
446
448
#ifndef __cplusplus
449
static
const
struct
rte_flow_item_eth
rte_flow_item_eth_mask
= {
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
464
struct
rte_flow_item_vlan
{
465
rte_be16_t
tpid
;
466
rte_be16_t
tci
;
467
};
468
470
#ifndef __cplusplus
471
static
const
struct
rte_flow_item_vlan
rte_flow_item_vlan_mask
= {
472
.
tpid
= RTE_BE16(0x0000),
473
.tci = RTE_BE16(0xffff),
474
};
475
#endif
476
484
struct
rte_flow_item_ipv4
{
485
struct
ipv4_hdr
hdr
;
486
};
487
489
#ifndef __cplusplus
490
static
const
struct
rte_flow_item_ipv4
rte_flow_item_ipv4_mask
= {
491
.
hdr
= {
492
.
src_addr
= RTE_BE32(0xffffffff),
493
.dst_addr = RTE_BE32(0xffffffff),
494
},
495
};
496
#endif
497
505
struct
rte_flow_item_ipv6
{
506
struct
ipv6_hdr
hdr
;
507
};
508
510
#ifndef __cplusplus
511
static
const
struct
rte_flow_item_ipv6
rte_flow_item_ipv6_mask
= {
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
528
struct
rte_flow_item_icmp
{
529
struct
icmp_hdr
hdr
;
530
};
531
533
#ifndef __cplusplus
534
static
const
struct
rte_flow_item_icmp
rte_flow_item_icmp_mask
= {
535
.
hdr
= {
536
.icmp_type = 0xff,
537
.icmp_code = 0xff,
538
},
539
};
540
#endif
541
547
struct
rte_flow_item_udp
{
548
struct
udp_hdr
hdr
;
549
};
550
552
#ifndef __cplusplus
553
static
const
struct
rte_flow_item_udp
rte_flow_item_udp_mask
= {
554
.
hdr
= {
555
.
src_port
= RTE_BE16(0xffff),
556
.dst_port = RTE_BE16(0xffff),
557
},
558
};
559
#endif
560
566
struct
rte_flow_item_tcp
{
567
struct
tcp_hdr
hdr
;
568
};
569
571
#ifndef __cplusplus
572
static
const
struct
rte_flow_item_tcp
rte_flow_item_tcp_mask
= {
573
.
hdr
= {
574
.
src_port
= RTE_BE16(0xffff),
575
.dst_port = RTE_BE16(0xffff),
576
},
577
};
578
#endif
579
585
struct
rte_flow_item_sctp
{
586
struct
sctp_hdr
hdr
;
587
};
588
590
#ifndef __cplusplus
591
static
const
struct
rte_flow_item_sctp
rte_flow_item_sctp_mask
= {
592
.
hdr
= {
593
.
src_port
= RTE_BE16(0xffff),
594
.dst_port = RTE_BE16(0xffff),
595
},
596
};
597
#endif
598
604
struct
rte_flow_item_vxlan
{
605
uint8_t
flags
;
606
uint8_t
rsvd0
[3];
607
uint8_t
vni
[3];
608
uint8_t
rsvd1
;
609
};
610
612
#ifndef __cplusplus
613
static
const
struct
rte_flow_item_vxlan
rte_flow_item_vxlan_mask
= {
614
.
vni
=
"\xff\xff\xff"
,
615
};
616
#endif
617
623
struct
rte_flow_item_e_tag
{
624
rte_be16_t
tpid
;
629
rte_be16_t
epcp_edei_in_ecid_b
;
631
rte_be16_t
rsvd_grp_ecid_b
;
632
uint8_t
in_ecid_e
;
633
uint8_t
ecid_e
;
634
};
635
637
#ifndef __cplusplus
638
static
const
struct
rte_flow_item_e_tag
rte_flow_item_e_tag_mask
= {
639
.
rsvd_grp_ecid_b
= RTE_BE16(0x3fff),
640
};
641
#endif
642
648
struct
rte_flow_item_nvgre
{
655
rte_be16_t
c_k_s_rsvd0_ver
;
656
rte_be16_t
protocol
;
657
uint8_t
tni
[3];
658
uint8_t
flow_id
;
659
};
660
662
#ifndef __cplusplus
663
static
const
struct
rte_flow_item_nvgre
rte_flow_item_nvgre_mask
= {
664
.
tni
=
"\xff\xff\xff"
,
665
};
666
#endif
667
673
struct
rte_flow_item_mpls
{
677
uint8_t
label_tc_s
[3];
678
uint8_t ttl;
679
};
680
682
#ifndef __cplusplus
683
static
const
struct
rte_flow_item_mpls
rte_flow_item_mpls_mask
= {
684
.
label_tc_s
=
"\xff\xff\xf0"
,
685
};
686
#endif
687
693
struct
rte_flow_item_gre
{
698
rte_be16_t
c_rsvd0_ver
;
699
rte_be16_t
protocol
;
700
};
701
703
#ifndef __cplusplus
704
static
const
struct
rte_flow_item_gre
rte_flow_item_gre_mask
= {
705
.
protocol
= RTE_BE16(0xffff),
706
};
707
#endif
708
726
struct
rte_flow_item_fuzzy
{
727
uint32_t
thresh
;
728
};
729
731
#ifndef __cplusplus
732
static
const
struct
rte_flow_item_fuzzy
rte_flow_item_fuzzy_mask
= {
733
.
thresh
= 0xffffffff,
734
};
735
#endif
736
770
struct
rte_flow_item
{
771
enum
rte_flow_item_type
type
;
772
const
void
*
spec
;
773
const
void
*
last
;
774
const
void
*
mask
;
775
};
776
805
enum
rte_flow_action_type
{
814
RTE_FLOW_ACTION_TYPE_END
,
815
824
RTE_FLOW_ACTION_TYPE_VOID
,
825
834
RTE_FLOW_ACTION_TYPE_PASSTHRU
,
835
844
RTE_FLOW_ACTION_TYPE_MARK
,
845
854
RTE_FLOW_ACTION_TYPE_FLAG
,
855
861
RTE_FLOW_ACTION_TYPE_QUEUE
,
862
870
RTE_FLOW_ACTION_TYPE_DROP
,
871
882
RTE_FLOW_ACTION_TYPE_COUNT
,
883
892
RTE_FLOW_ACTION_TYPE_DUP
,
893
901
RTE_FLOW_ACTION_TYPE_RSS
,
902
909
RTE_FLOW_ACTION_TYPE_PF
,
910
917
RTE_FLOW_ACTION_TYPE_VF
,
918
};
919
930
struct
rte_flow_action_mark
{
931
uint32_t
id
;
932
};
933
941
struct
rte_flow_action_queue
{
942
uint16_t
index
;
943
};
944
950
struct
rte_flow_query_count
{
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
969
struct
rte_flow_action_dup
{
970
uint16_t
index
;
971
};
972
985
struct
rte_flow_action_rss
{
986
const
struct
rte_eth_rss_conf
*
rss_conf
;
987
uint16_t
num
;
988
uint16_t
queue
[];
989
};
990
1004
struct
rte_flow_action_vf
{
1005
uint32_t
original
:1;
1006
uint32_t
reserved
:31;
1007
uint32_t
id
;
1008
};
1009
1017
struct
rte_flow_action
{
1018
enum
rte_flow_action_type
type
;
1019
const
void
*
conf
;
1020
};
1021
1028
struct
rte_flow;
1029
1036
enum
rte_flow_error_type
{
1037
RTE_FLOW_ERROR_TYPE_NONE
,
1038
RTE_FLOW_ERROR_TYPE_UNSPECIFIED
,
1039
RTE_FLOW_ERROR_TYPE_HANDLE
,
1040
RTE_FLOW_ERROR_TYPE_ATTR_GROUP
,
1041
RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY
,
1042
RTE_FLOW_ERROR_TYPE_ATTR_INGRESS
,
1043
RTE_FLOW_ERROR_TYPE_ATTR_EGRESS
,
1044
RTE_FLOW_ERROR_TYPE_ATTR
,
1045
RTE_FLOW_ERROR_TYPE_ITEM_NUM
,
1046
RTE_FLOW_ERROR_TYPE_ITEM
,
1047
RTE_FLOW_ERROR_TYPE_ACTION_NUM
,
1048
RTE_FLOW_ERROR_TYPE_ACTION
,
1049
};
1050
1062
struct
rte_flow_error
{
1063
enum
rte_flow_error_type
type
;
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
1278
struct
rte_flow_desc
{
1279
size_t
size
;
1280
struct
rte_flow_attr
attr
;
1281
struct
rte_flow_item
*
items
;
1282
struct
rte_flow_action
*
actions
;
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_ */
Generated by
1.8.1.2