DPDK
18.02.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
/* SPDX-License-Identifier: BSD-3-Clause
2
* Copyright 2016 6WIND S.A.
3
* Copyright 2016 Mellanox.
4
*/
5
6
#ifndef RTE_FLOW_H_
7
#define RTE_FLOW_H_
8
17
#include <stdint.h>
18
19
#include <
rte_arp.h
>
20
#include <
rte_ether.h
>
21
#include <
rte_icmp.h
>
22
#include <
rte_ip.h
>
23
#include <
rte_sctp.h
>
24
#include <
rte_tcp.h
>
25
#include <
rte_udp.h
>
26
#include <
rte_byteorder.h
>
27
#include <
rte_esp.h
>
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
68
struct
rte_flow_attr
{
69
uint32_t
group
;
70
uint32_t
priority
;
71
uint32_t
ingress
:1;
72
uint32_t
egress
:1;
73
uint32_t
reserved
:30;
74
};
75
94
enum
rte_flow_item_type
{
103
RTE_FLOW_ITEM_TYPE_END
,
104
113
RTE_FLOW_ITEM_TYPE_VOID
,
114
123
RTE_FLOW_ITEM_TYPE_INVERT
,
124
131
RTE_FLOW_ITEM_TYPE_ANY
,
132
146
RTE_FLOW_ITEM_TYPE_PF
,
147
161
RTE_FLOW_ITEM_TYPE_VF
,
162
176
RTE_FLOW_ITEM_TYPE_PORT
,
177
183
RTE_FLOW_ITEM_TYPE_RAW
,
184
190
RTE_FLOW_ITEM_TYPE_ETH
,
191
197
RTE_FLOW_ITEM_TYPE_VLAN
,
198
204
RTE_FLOW_ITEM_TYPE_IPV4
,
205
211
RTE_FLOW_ITEM_TYPE_IPV6
,
212
218
RTE_FLOW_ITEM_TYPE_ICMP
,
219
225
RTE_FLOW_ITEM_TYPE_UDP
,
226
232
RTE_FLOW_ITEM_TYPE_TCP
,
233
239
RTE_FLOW_ITEM_TYPE_SCTP
,
240
246
RTE_FLOW_ITEM_TYPE_VXLAN
,
247
253
RTE_FLOW_ITEM_TYPE_E_TAG
,
254
260
RTE_FLOW_ITEM_TYPE_NVGRE
,
261
267
RTE_FLOW_ITEM_TYPE_MPLS
,
268
274
RTE_FLOW_ITEM_TYPE_GRE
,
275
286
RTE_FLOW_ITEM_TYPE_FUZZY
,
287
295
RTE_FLOW_ITEM_TYPE_GTP
,
296
304
RTE_FLOW_ITEM_TYPE_GTPC
,
305
313
RTE_FLOW_ITEM_TYPE_GTPU
,
314
320
RTE_FLOW_ITEM_TYPE_ESP
,
321
327
RTE_FLOW_ITEM_TYPE_GENEVE
,
328
};
329
341
struct
rte_flow_item_any
{
342
uint32_t
num
;
343
};
344
346
#ifndef __cplusplus
347
static
const
struct
rte_flow_item_any
rte_flow_item_any_mask
= {
348
.
num
= 0x00000000,
349
};
350
#endif
351
370
struct
rte_flow_item_vf
{
371
uint32_t
id
;
372
};
373
375
#ifndef __cplusplus
376
static
const
struct
rte_flow_item_vf
rte_flow_item_vf_mask
= {
377
.
id
= 0x00000000,
378
};
379
#endif
380
401
struct
rte_flow_item_port
{
402
uint32_t
index
;
403
};
404
406
#ifndef __cplusplus
407
static
const
struct
rte_flow_item_port
rte_flow_item_port_mask
= {
408
.
index
= 0x00000000,
409
};
410
#endif
411
430
struct
rte_flow_item_raw
{
431
uint32_t
relative
:1;
432
uint32_t
search
:1;
433
uint32_t
reserved
:30;
434
int32_t
offset
;
435
uint16_t
limit
;
436
uint16_t
length
;
437
uint8_t
pattern
[];
438
};
439
441
#ifndef __cplusplus
442
static
const
struct
rte_flow_item_raw
rte_flow_item_raw_mask
= {
443
.
relative
= 1,
444
.search = 1,
445
.reserved = 0x3fffffff,
446
.offset = 0xffffffff,
447
.limit = 0xffff,
448
.length = 0xffff,
449
};
450
#endif
451
457
struct
rte_flow_item_eth
{
458
struct
ether_addr
dst
;
459
struct
ether_addr
src
;
460
rte_be16_t
type
;
461
};
462
464
#ifndef __cplusplus
465
static
const
struct
rte_flow_item_eth
rte_flow_item_eth_mask
= {
466
.
dst
.
addr_bytes
=
"\xff\xff\xff\xff\xff\xff"
,
467
.src.addr_bytes =
"\xff\xff\xff\xff\xff\xff"
,
468
.type = RTE_BE16(0x0000),
469
};
470
#endif
471
480
struct
rte_flow_item_vlan
{
481
rte_be16_t
tpid
;
482
rte_be16_t
tci
;
483
};
484
486
#ifndef __cplusplus
487
static
const
struct
rte_flow_item_vlan
rte_flow_item_vlan_mask
= {
488
.
tpid
= RTE_BE16(0x0000),
489
.tci = RTE_BE16(0xffff),
490
};
491
#endif
492
500
struct
rte_flow_item_ipv4
{
501
struct
ipv4_hdr
hdr
;
502
};
503
505
#ifndef __cplusplus
506
static
const
struct
rte_flow_item_ipv4
rte_flow_item_ipv4_mask
= {
507
.
hdr
= {
508
.
src_addr
= RTE_BE32(0xffffffff),
509
.dst_addr = RTE_BE32(0xffffffff),
510
},
511
};
512
#endif
513
521
struct
rte_flow_item_ipv6
{
522
struct
ipv6_hdr
hdr
;
523
};
524
526
#ifndef __cplusplus
527
static
const
struct
rte_flow_item_ipv6
rte_flow_item_ipv6_mask
= {
528
.
hdr
= {
529
.
src_addr
=
530
"\xff\xff\xff\xff\xff\xff\xff\xff"
531
"\xff\xff\xff\xff\xff\xff\xff\xff"
,
532
.dst_addr =
533
"\xff\xff\xff\xff\xff\xff\xff\xff"
534
"\xff\xff\xff\xff\xff\xff\xff\xff"
,
535
},
536
};
537
#endif
538
544
struct
rte_flow_item_icmp
{
545
struct
icmp_hdr
hdr
;
546
};
547
549
#ifndef __cplusplus
550
static
const
struct
rte_flow_item_icmp
rte_flow_item_icmp_mask
= {
551
.
hdr
= {
552
.icmp_type = 0xff,
553
.icmp_code = 0xff,
554
},
555
};
556
#endif
557
563
struct
rte_flow_item_udp
{
564
struct
udp_hdr
hdr
;
565
};
566
568
#ifndef __cplusplus
569
static
const
struct
rte_flow_item_udp
rte_flow_item_udp_mask
= {
570
.
hdr
= {
571
.
src_port
= RTE_BE16(0xffff),
572
.dst_port = RTE_BE16(0xffff),
573
},
574
};
575
#endif
576
582
struct
rte_flow_item_tcp
{
583
struct
tcp_hdr
hdr
;
584
};
585
587
#ifndef __cplusplus
588
static
const
struct
rte_flow_item_tcp
rte_flow_item_tcp_mask
= {
589
.
hdr
= {
590
.
src_port
= RTE_BE16(0xffff),
591
.dst_port = RTE_BE16(0xffff),
592
},
593
};
594
#endif
595
601
struct
rte_flow_item_sctp
{
602
struct
sctp_hdr
hdr
;
603
};
604
606
#ifndef __cplusplus
607
static
const
struct
rte_flow_item_sctp
rte_flow_item_sctp_mask
= {
608
.
hdr
= {
609
.
src_port
= RTE_BE16(0xffff),
610
.dst_port = RTE_BE16(0xffff),
611
},
612
};
613
#endif
614
620
struct
rte_flow_item_vxlan
{
621
uint8_t
flags
;
622
uint8_t
rsvd0
[3];
623
uint8_t
vni
[3];
624
uint8_t
rsvd1
;
625
};
626
628
#ifndef __cplusplus
629
static
const
struct
rte_flow_item_vxlan
rte_flow_item_vxlan_mask
= {
630
.
vni
=
"\xff\xff\xff"
,
631
};
632
#endif
633
639
struct
rte_flow_item_e_tag
{
640
rte_be16_t
tpid
;
645
rte_be16_t
epcp_edei_in_ecid_b
;
647
rte_be16_t
rsvd_grp_ecid_b
;
648
uint8_t
in_ecid_e
;
649
uint8_t
ecid_e
;
650
};
651
653
#ifndef __cplusplus
654
static
const
struct
rte_flow_item_e_tag
rte_flow_item_e_tag_mask
= {
655
.
rsvd_grp_ecid_b
= RTE_BE16(0x3fff),
656
};
657
#endif
658
664
struct
rte_flow_item_nvgre
{
671
rte_be16_t
c_k_s_rsvd0_ver
;
672
rte_be16_t
protocol
;
673
uint8_t
tni
[3];
674
uint8_t
flow_id
;
675
};
676
678
#ifndef __cplusplus
679
static
const
struct
rte_flow_item_nvgre
rte_flow_item_nvgre_mask
= {
680
.
tni
=
"\xff\xff\xff"
,
681
};
682
#endif
683
689
struct
rte_flow_item_mpls
{
693
uint8_t
label_tc_s
[3];
694
uint8_t ttl;
695
};
696
698
#ifndef __cplusplus
699
static
const
struct
rte_flow_item_mpls
rte_flow_item_mpls_mask
= {
700
.
label_tc_s
=
"\xff\xff\xf0"
,
701
};
702
#endif
703
709
struct
rte_flow_item_gre
{
714
rte_be16_t
c_rsvd0_ver
;
715
rte_be16_t
protocol
;
716
};
717
719
#ifndef __cplusplus
720
static
const
struct
rte_flow_item_gre
rte_flow_item_gre_mask
= {
721
.
protocol
= RTE_BE16(0xffff),
722
};
723
#endif
724
742
struct
rte_flow_item_fuzzy
{
743
uint32_t
thresh
;
744
};
745
747
#ifndef __cplusplus
748
static
const
struct
rte_flow_item_fuzzy
rte_flow_item_fuzzy_mask
= {
749
.
thresh
= 0xffffffff,
750
};
751
#endif
752
758
struct
rte_flow_item_gtp
{
765
uint8_t
v_pt_rsv_flags
;
766
uint8_t
msg_type
;
767
rte_be16_t
msg_len
;
768
rte_be32_t
teid
;
769
};
770
772
#ifndef __cplusplus
773
static
const
struct
rte_flow_item_gtp
rte_flow_item_gtp_mask
= {
774
.
teid
= RTE_BE32(0xffffffff),
775
};
776
#endif
777
783
struct
rte_flow_item_esp
{
784
struct
esp_hdr
hdr
;
785
};
786
788
#ifndef __cplusplus
789
static
const
struct
rte_flow_item_esp
rte_flow_item_esp_mask
= {
790
.
hdr
= {
791
.
spi
= 0xffffffff,
792
},
793
};
794
#endif
795
801
struct
rte_flow_item_geneve
{
806
rte_be16_t
ver_opt_len_o_c_rsvd0
;
807
rte_be16_t
protocol
;
808
uint8_t
vni
[3];
809
uint8_t
rsvd1
;
810
};
811
813
#ifndef __cplusplus
814
static
const
struct
rte_flow_item_geneve
rte_flow_item_geneve_mask
= {
815
.
vni
=
"\xff\xff\xff"
,
816
};
817
#endif
818
852
struct
rte_flow_item
{
853
enum
rte_flow_item_type
type
;
854
const
void
*
spec
;
855
const
void
*
last
;
856
const
void
*
mask
;
857
};
858
887
enum
rte_flow_action_type
{
896
RTE_FLOW_ACTION_TYPE_END
,
897
906
RTE_FLOW_ACTION_TYPE_VOID
,
907
916
RTE_FLOW_ACTION_TYPE_PASSTHRU
,
917
926
RTE_FLOW_ACTION_TYPE_MARK
,
927
936
RTE_FLOW_ACTION_TYPE_FLAG
,
937
943
RTE_FLOW_ACTION_TYPE_QUEUE
,
944
952
RTE_FLOW_ACTION_TYPE_DROP
,
953
964
RTE_FLOW_ACTION_TYPE_COUNT
,
965
974
RTE_FLOW_ACTION_TYPE_DUP
,
975
983
RTE_FLOW_ACTION_TYPE_RSS
,
984
991
RTE_FLOW_ACTION_TYPE_PF
,
992
999
RTE_FLOW_ACTION_TYPE_VF
,
1000
1007
RTE_FLOW_ACTION_TYPE_METER
,
1008
1015
RTE_FLOW_ACTION_TYPE_SECURITY
1016
};
1017
1028
struct
rte_flow_action_mark
{
1029
uint32_t
id
;
1030
};
1031
1039
struct
rte_flow_action_queue
{
1040
uint16_t
index
;
1041
};
1042
1048
struct
rte_flow_query_count
{
1049
uint32_t
reset
:1;
1050
uint32_t
hits_set
:1;
1051
uint32_t
bytes_set
:1;
1052
uint32_t
reserved
:29;
1053
uint64_t
hits
;
1054
uint64_t
bytes
;
1055
};
1056
1067
struct
rte_flow_action_dup
{
1068
uint16_t
index
;
1069
};
1070
1083
struct
rte_flow_action_rss
{
1084
const
struct
rte_eth_rss_conf
*
rss_conf
;
1085
uint16_t
num
;
1086
uint16_t
queue
[];
1087
};
1088
1102
struct
rte_flow_action_vf
{
1103
uint32_t
original
:1;
1104
uint32_t
reserved
:31;
1105
uint32_t
id
;
1106
};
1107
1118
struct
rte_flow_action_meter
{
1119
uint32_t
mtr_id
;
1120
};
1121
1149
struct
rte_flow_action_security
{
1150
void
*
security_session
;
1151
};
1152
1160
struct
rte_flow_action
{
1161
enum
rte_flow_action_type
type
;
1162
const
void
*
conf
;
1163
};
1164
1171
struct
rte_flow;
1172
1179
enum
rte_flow_error_type
{
1180
RTE_FLOW_ERROR_TYPE_NONE
,
1181
RTE_FLOW_ERROR_TYPE_UNSPECIFIED
,
1182
RTE_FLOW_ERROR_TYPE_HANDLE
,
1183
RTE_FLOW_ERROR_TYPE_ATTR_GROUP
,
1184
RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY
,
1185
RTE_FLOW_ERROR_TYPE_ATTR_INGRESS
,
1186
RTE_FLOW_ERROR_TYPE_ATTR_EGRESS
,
1187
RTE_FLOW_ERROR_TYPE_ATTR
,
1188
RTE_FLOW_ERROR_TYPE_ITEM_NUM
,
1189
RTE_FLOW_ERROR_TYPE_ITEM
,
1190
RTE_FLOW_ERROR_TYPE_ACTION_NUM
,
1191
RTE_FLOW_ERROR_TYPE_ACTION
,
1192
};
1193
1205
struct
rte_flow_error
{
1206
enum
rte_flow_error_type
type
;
1207
const
void
*
cause
;
1208
const
char
*
message
;
1209
};
1210
1263
int
1264
rte_flow_validate
(uint16_t port_id,
1265
const
struct
rte_flow_attr
*attr,
1266
const
struct
rte_flow_item
pattern[],
1267
const
struct
rte_flow_action
actions[],
1268
struct
rte_flow_error
*error);
1269
1290
struct
rte_flow *
1291
rte_flow_create
(uint16_t port_id,
1292
const
struct
rte_flow_attr
*attr,
1293
const
struct
rte_flow_item
pattern[],
1294
const
struct
rte_flow_action
actions[],
1295
struct
rte_flow_error
*error);
1296
1317
int
1318
rte_flow_destroy
(uint16_t port_id,
1319
struct
rte_flow *flow,
1320
struct
rte_flow_error
*error);
1321
1338
int
1339
rte_flow_flush
(uint16_t port_id,
1340
struct
rte_flow_error
*error);
1341
1366
int
1367
rte_flow_query
(uint16_t port_id,
1368
struct
rte_flow *flow,
1369
enum
rte_flow_action_type
action,
1370
void
*data,
1371
struct
rte_flow_error
*error);
1372
1414
int
1415
rte_flow_isolate
(uint16_t port_id,
int
set
,
struct
rte_flow_error
*error);
1416
1434
int
1435
rte_flow_error_set
(
struct
rte_flow_error
*error,
1436
int
code,
1437
enum
rte_flow_error_type
type,
1438
const
void
*cause,
1439
const
char
*message);
1440
1447
struct
rte_flow_desc
{
1448
size_t
size
;
1449
struct
rte_flow_attr
attr
;
1450
struct
rte_flow_item
*
items
;
1451
struct
rte_flow_action
*
actions
;
1452
uint8_t
data
[];
1453
};
1454
1475
size_t
1476
rte_flow_copy
(
struct
rte_flow_desc
*fd,
size_t
len,
1477
const
struct
rte_flow_attr
*attr,
1478
const
struct
rte_flow_item
*items,
1479
const
struct
rte_flow_action
*actions);
1480
1481
#ifdef __cplusplus
1482
}
1483
#endif
1484
1485
#endif
/* RTE_FLOW_H_ */
Generated by
1.8.1.2