]> git.proxmox.com Git - ceph.git/blob - ceph/src/dpdk/examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / dpdk / examples / ip_pipeline / pipeline / pipeline_flow_actions_be.h
1 /*-
2 * BSD LICENSE
3 *
4 * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
5 * All rights reserved.
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 Intel Corporation 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 __INCLUDE_PIPELINE_FLOW_ACTIONS_BE_H__
35 #define __INCLUDE_PIPELINE_FLOW_ACTIONS_BE_H__
36
37 #include <rte_meter.h>
38
39 #include "pipeline_common_be.h"
40
41 #ifndef PIPELINE_FA_N_TC_MAX
42 #define PIPELINE_FA_N_TC_MAX 4
43 #endif
44
45 #define PIPELINE_FA_N_DSCP 64
46
47 struct pipeline_fa_params {
48 uint32_t n_flows;
49 uint32_t n_meters_per_flow;
50 uint32_t flow_id_offset;
51 uint32_t ip_hdr_offset;
52 uint32_t color_offset;
53 uint32_t dscp_enabled;
54 };
55
56 int
57 pipeline_fa_parse_args(struct pipeline_fa_params *p,
58 struct pipeline_params *params);
59
60 struct pipeline_fa_policer_action {
61 uint32_t drop;
62 enum rte_meter_color color;
63 };
64
65 struct pipeline_fa_policer_params {
66 struct pipeline_fa_policer_action action[e_RTE_METER_COLORS];
67 };
68
69 struct pipeline_fa_flow_params {
70 struct rte_meter_trtcm_params m[PIPELINE_FA_N_TC_MAX];
71 struct pipeline_fa_policer_params p[PIPELINE_FA_N_TC_MAX];
72 uint32_t port_id;
73 };
74
75 int
76 pipeline_fa_flow_params_set_default(struct pipeline_fa_flow_params *params);
77
78 struct pipeline_fa_policer_stats {
79 uint64_t n_pkts[e_RTE_METER_COLORS];
80 uint64_t n_pkts_drop;
81 };
82
83 enum pipeline_fa_msg_req_type {
84 PIPELINE_FA_MSG_REQ_FLOW_CONFIG = 0,
85 PIPELINE_FA_MSG_REQ_FLOW_CONFIG_BULK,
86 PIPELINE_FA_MSG_REQ_DSCP_CONFIG,
87 PIPELINE_FA_MSG_REQ_POLICER_STATS_READ,
88 PIPELINE_FA_MSG_REQS,
89 };
90
91 /*
92 * MSG FLOW CONFIG
93 */
94 struct pipeline_fa_flow_config_msg_req {
95 enum pipeline_msg_req_type type;
96 enum pipeline_fa_msg_req_type subtype;
97
98 void *entry_ptr;
99 uint32_t flow_id;
100
101 uint32_t meter_update_mask;
102 uint32_t policer_update_mask;
103 uint32_t port_update;
104 struct pipeline_fa_flow_params params;
105 };
106
107 struct pipeline_fa_flow_config_msg_rsp {
108 int status;
109 void *entry_ptr;
110 };
111
112 /*
113 * MSG FLOW CONFIG BULK
114 */
115 struct pipeline_fa_flow_config_bulk_msg_req {
116 enum pipeline_msg_req_type type;
117 enum pipeline_fa_msg_req_type subtype;
118
119 void **entry_ptr;
120 uint32_t *flow_id;
121 uint32_t n_flows;
122
123 uint32_t meter_update_mask;
124 uint32_t policer_update_mask;
125 uint32_t port_update;
126 struct pipeline_fa_flow_params *params;
127 };
128
129 struct pipeline_fa_flow_config_bulk_msg_rsp {
130 uint32_t n_flows;
131 };
132
133 /*
134 * MSG DSCP CONFIG
135 */
136 struct pipeline_fa_dscp_config_msg_req {
137 enum pipeline_msg_req_type type;
138 enum pipeline_fa_msg_req_type subtype;
139
140 uint32_t dscp;
141 uint32_t traffic_class;
142 enum rte_meter_color color;
143 };
144
145 struct pipeline_fa_dscp_config_msg_rsp {
146 int status;
147 };
148
149 /*
150 * MSG POLICER STATS READ
151 */
152 struct pipeline_fa_policer_stats_msg_req {
153 enum pipeline_msg_req_type type;
154 enum pipeline_fa_msg_req_type subtype;
155
156 void *entry_ptr;
157 uint32_t policer_id;
158 int clear;
159 };
160
161 struct pipeline_fa_policer_stats_msg_rsp {
162 int status;
163 struct pipeline_fa_policer_stats stats;
164 };
165
166 extern struct pipeline_be_ops pipeline_flow_actions_be_ops;
167
168 #endif