New upstream version 18.02
[deb_dpdk.git] / examples / ip_pipeline / pipeline / pipeline_flow_classification.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2015 Intel Corporation
3  */
4
5 #ifndef __INCLUDE_PIPELINE_FLOW_CLASSIFICATION_H__
6 #define __INCLUDE_PIPELINE_FLOW_CLASSIFICATION_H__
7
8 #include "pipeline.h"
9 #include "pipeline_flow_classification_be.h"
10
11 enum flow_key_type {
12         FLOW_KEY_QINQ,
13         FLOW_KEY_IPV4_5TUPLE,
14         FLOW_KEY_IPV6_5TUPLE,
15 };
16
17 struct flow_key_qinq {
18         uint16_t svlan;
19         uint16_t cvlan;
20 };
21
22 struct flow_key_ipv4_5tuple {
23         uint32_t ip_src;
24         uint32_t ip_dst;
25         uint16_t port_src;
26         uint16_t port_dst;
27         uint32_t proto;
28 };
29
30 struct flow_key_ipv6_5tuple {
31         uint8_t ip_src[16];
32         uint8_t ip_dst[16];
33         uint16_t port_src;
34         uint16_t port_dst;
35         uint32_t proto;
36 };
37
38 struct pipeline_fc_key {
39         enum flow_key_type type;
40         union {
41                 struct flow_key_qinq qinq;
42                 struct flow_key_ipv4_5tuple ipv4_5tuple;
43                 struct flow_key_ipv6_5tuple ipv6_5tuple;
44         } key;
45 };
46
47 int
48 app_pipeline_fc_add(struct app_params *app,
49         uint32_t pipeline_id,
50         struct pipeline_fc_key *key,
51         uint32_t port_id,
52         uint32_t flow_id);
53
54 int
55 app_pipeline_fc_add_bulk(struct app_params *app,
56         uint32_t pipeline_id,
57         struct pipeline_fc_key *key,
58         uint32_t *port_id,
59         uint32_t *flow_id,
60         uint32_t n_keys);
61
62 int
63 app_pipeline_fc_del(struct app_params *app,
64         uint32_t pipeline_id,
65         struct pipeline_fc_key *key);
66
67 int
68 app_pipeline_fc_add_default(struct app_params *app,
69         uint32_t pipeline_id,
70         uint32_t port_id);
71
72 int
73 app_pipeline_fc_del_default(struct app_params *app,
74         uint32_t pipeline_id);
75
76 #ifndef APP_PIPELINE_FC_MAX_FLOWS_IN_FILE
77 #define APP_PIPELINE_FC_MAX_FLOWS_IN_FILE       (16 * 1024 * 1024)
78 #endif
79
80 int
81 app_pipeline_fc_load_file_qinq(char *filename,
82         struct pipeline_fc_key *keys,
83         uint32_t *port_ids,
84         uint32_t *flow_ids,
85         uint32_t *n_keys,
86         uint32_t *line);
87
88 int
89 app_pipeline_fc_load_file_ipv4(char *filename,
90         struct pipeline_fc_key *keys,
91         uint32_t *port_ids,
92         uint32_t *flow_ids,
93         uint32_t *n_keys,
94         uint32_t *line);
95
96 int
97 app_pipeline_fc_load_file_ipv6(char *filename,
98         struct pipeline_fc_key *keys,
99         uint32_t *port_ids,
100         uint32_t *flow_ids,
101         uint32_t *n_keys,
102         uint32_t *line);
103
104 extern struct pipeline_type pipeline_flow_classification;
105
106 #endif