1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
5 #ifndef _INCLUDE_PIPELINE_H_
6 #define _INCLUDE_PIPELINE_H_
11 #include <rte_pipeline.h>
12 #include <rte_table_action.h>
17 struct pipeline_params {
18 uint32_t timer_period_ms;
19 uint32_t offset_port_id;
32 struct port_in_params {
34 enum port_in_type type;
42 const char *mempool_name;
47 const char *mempool_name;
48 const char *file_name;
49 uint32_t n_bytes_per_pkt;
55 const char *action_profile_name;
67 struct port_out_params {
68 enum port_out_type type;
76 const char *file_name;
93 struct table_acl_params {
95 uint32_t ip_header_offset;
99 struct table_array_params {
104 struct table_hash_params {
110 int extendable_bucket;
113 struct table_lpm_params {
119 struct table_params {
121 enum table_type match_type;
123 struct table_acl_params acl;
124 struct table_array_params array;
125 struct table_hash_params hash;
126 struct table_lpm_params lpm;
130 const char *action_profile_name;
134 struct port_in_params params;
135 struct port_in_action_profile *ap;
136 struct rte_port_in_action *a;
140 struct table_params params;
141 struct table_action_profile *ap;
142 struct rte_table_action *a;
146 TAILQ_ENTRY(pipeline) node;
147 char name[NAME_SIZE];
149 struct rte_pipeline *p;
150 struct port_in port_in[RTE_PIPELINE_PORT_IN_MAX];
151 struct table table[RTE_PIPELINE_TABLE_MAX];
153 uint32_t n_ports_out;
156 struct rte_ring *msgq_req;
157 struct rte_ring *msgq_rsp;
158 uint32_t timer_period_ms;
165 TAILQ_HEAD(pipeline_list, pipeline);
171 pipeline_find(const char *name);
174 pipeline_create(const char *name, struct pipeline_params *params);
177 pipeline_port_in_create(const char *pipeline_name,
178 struct port_in_params *params,
182 pipeline_port_in_connect_to_table(const char *pipeline_name,
187 pipeline_port_out_create(const char *pipeline_name,
188 struct port_out_params *params);
191 pipeline_table_create(const char *pipeline_name,
192 struct table_params *params);
194 struct table_rule_match_acl {
221 struct table_rule_match_array {
225 #ifndef TABLE_RULE_MATCH_SIZE_MAX
226 #define TABLE_RULE_MATCH_SIZE_MAX 256
229 #ifndef TABLE_RULE_ACTION_SIZE_MAX
230 #define TABLE_RULE_ACTION_SIZE_MAX 2048
233 struct table_rule_match_hash {
234 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
237 struct table_rule_match_lpm {
249 struct table_rule_match {
250 enum table_type match_type;
253 struct table_rule_match_acl acl;
254 struct table_rule_match_array array;
255 struct table_rule_match_hash hash;
256 struct table_rule_match_lpm lpm;
260 struct table_rule_action {
261 uint64_t action_mask;
262 struct rte_table_action_fwd_params fwd;
263 struct rte_table_action_mtr_params mtr;
264 struct rte_table_action_tm_params tm;
265 struct rte_table_action_encap_params encap;
266 struct rte_table_action_nat_params nat;
267 struct rte_table_action_ttl_params ttl;
268 struct rte_table_action_stats_params stats;
269 struct rte_table_action_time_params time;
273 pipeline_port_in_stats_read(const char *pipeline_name,
275 struct rte_pipeline_port_in_stats *stats,
279 pipeline_port_in_enable(const char *pipeline_name,
283 pipeline_port_in_disable(const char *pipeline_name,
287 pipeline_port_out_stats_read(const char *pipeline_name,
289 struct rte_pipeline_port_out_stats *stats,
293 pipeline_table_stats_read(const char *pipeline_name,
295 struct rte_pipeline_table_stats *stats,
299 pipeline_table_rule_add(const char *pipeline_name,
301 struct table_rule_match *match,
302 struct table_rule_action *action,
306 pipeline_table_rule_add_bulk(const char *pipeline_name,
308 struct table_rule_match *match,
309 struct table_rule_action *action,
314 pipeline_table_rule_add_default(const char *pipeline_name,
316 struct table_rule_action *action,
320 pipeline_table_rule_delete(const char *pipeline_name,
322 struct table_rule_match *match);
325 pipeline_table_rule_delete_default(const char *pipeline_name,
329 pipeline_table_rule_stats_read(const char *pipeline_name,
332 struct rte_table_action_stats_counters *stats,
335 #endif /* _INCLUDE_PIPELINE_H_ */