New upstream version 18.02
[deb_dpdk.git] / examples / ip_pipeline / pipeline / pipeline_flow_actions_be.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2015 Intel Corporation
3  */
4
5 #ifndef __INCLUDE_PIPELINE_FLOW_ACTIONS_BE_H__
6 #define __INCLUDE_PIPELINE_FLOW_ACTIONS_BE_H__
7
8 #include <rte_meter.h>
9
10 #include "pipeline_common_be.h"
11
12 #ifndef PIPELINE_FA_N_TC_MAX
13 #define PIPELINE_FA_N_TC_MAX                               4
14 #endif
15
16 #define PIPELINE_FA_N_DSCP                                 64
17
18 struct pipeline_fa_params {
19         uint32_t n_flows;
20         uint32_t n_meters_per_flow;
21         uint32_t flow_id_offset;
22         uint32_t ip_hdr_offset;
23         uint32_t color_offset;
24         uint32_t dscp_enabled;
25 };
26
27 int
28 pipeline_fa_parse_args(struct pipeline_fa_params *p,
29         struct pipeline_params *params);
30
31 struct pipeline_fa_policer_action {
32         uint32_t drop;
33         enum rte_meter_color color;
34 };
35
36 struct pipeline_fa_policer_params {
37         struct pipeline_fa_policer_action action[e_RTE_METER_COLORS];
38 };
39
40 struct pipeline_fa_flow_params {
41         struct rte_meter_trtcm_params m[PIPELINE_FA_N_TC_MAX];
42         struct pipeline_fa_policer_params p[PIPELINE_FA_N_TC_MAX];
43         uint32_t port_id;
44 };
45
46 int
47 pipeline_fa_flow_params_set_default(struct pipeline_fa_flow_params *params);
48
49 struct pipeline_fa_policer_stats {
50         uint64_t n_pkts[e_RTE_METER_COLORS];
51         uint64_t n_pkts_drop;
52 };
53
54 enum pipeline_fa_msg_req_type {
55         PIPELINE_FA_MSG_REQ_FLOW_CONFIG = 0,
56         PIPELINE_FA_MSG_REQ_FLOW_CONFIG_BULK,
57         PIPELINE_FA_MSG_REQ_DSCP_CONFIG,
58         PIPELINE_FA_MSG_REQ_POLICER_STATS_READ,
59         PIPELINE_FA_MSG_REQS,
60 };
61
62 /*
63  * MSG FLOW CONFIG
64  */
65 struct pipeline_fa_flow_config_msg_req {
66         enum pipeline_msg_req_type type;
67         enum pipeline_fa_msg_req_type subtype;
68
69         void *entry_ptr;
70         uint32_t flow_id;
71
72         uint32_t meter_update_mask;
73         uint32_t policer_update_mask;
74         uint32_t port_update;
75         struct pipeline_fa_flow_params params;
76 };
77
78 struct pipeline_fa_flow_config_msg_rsp {
79         int status;
80         void *entry_ptr;
81 };
82
83 /*
84  * MSG FLOW CONFIG BULK
85  */
86 struct pipeline_fa_flow_config_bulk_msg_req {
87         enum pipeline_msg_req_type type;
88         enum pipeline_fa_msg_req_type subtype;
89
90         void **entry_ptr;
91         uint32_t *flow_id;
92         uint32_t n_flows;
93
94         uint32_t meter_update_mask;
95         uint32_t policer_update_mask;
96         uint32_t port_update;
97         struct pipeline_fa_flow_params *params;
98 };
99
100 struct pipeline_fa_flow_config_bulk_msg_rsp {
101         uint32_t n_flows;
102 };
103
104 /*
105  * MSG DSCP CONFIG
106  */
107 struct pipeline_fa_dscp_config_msg_req {
108         enum pipeline_msg_req_type type;
109         enum pipeline_fa_msg_req_type subtype;
110
111         uint32_t dscp;
112         uint32_t traffic_class;
113         enum rte_meter_color color;
114 };
115
116 struct pipeline_fa_dscp_config_msg_rsp {
117         int status;
118 };
119
120 /*
121  * MSG POLICER STATS READ
122  */
123 struct pipeline_fa_policer_stats_msg_req {
124         enum pipeline_msg_req_type type;
125         enum pipeline_fa_msg_req_type subtype;
126
127         void *entry_ptr;
128         uint32_t policer_id;
129         int clear;
130 };
131
132 struct pipeline_fa_policer_stats_msg_rsp {
133         int status;
134         struct pipeline_fa_policer_stats stats;
135 };
136
137 extern struct pipeline_be_ops pipeline_flow_actions_be_ops;
138
139 #endif