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;
33 struct port_in_params {
35 enum port_in_type type;
43 const char *mempool_name;
48 const char *mempool_name;
49 const char *file_name;
50 uint32_t n_bytes_per_pkt;
62 const char *action_profile_name;
75 struct port_out_params {
76 enum port_out_type type;
84 const char *file_name;
106 struct table_acl_params {
108 uint32_t ip_header_offset;
112 struct table_array_params {
117 struct table_hash_params {
123 int extendable_bucket;
126 struct table_lpm_params {
132 struct table_params {
134 enum table_type match_type;
136 struct table_acl_params acl;
137 struct table_array_params array;
138 struct table_hash_params hash;
139 struct table_lpm_params lpm;
143 const char *action_profile_name;
147 struct port_in_params params;
148 struct port_in_action_profile *ap;
149 struct rte_port_in_action *a;
153 struct table_params params;
154 struct table_action_profile *ap;
155 struct rte_table_action *a;
159 TAILQ_ENTRY(pipeline) node;
160 char name[NAME_SIZE];
162 struct rte_pipeline *p;
163 struct port_in port_in[RTE_PIPELINE_PORT_IN_MAX];
164 struct table table[RTE_PIPELINE_TABLE_MAX];
166 uint32_t n_ports_out;
169 struct rte_ring *msgq_req;
170 struct rte_ring *msgq_rsp;
171 uint32_t timer_period_ms;
178 TAILQ_HEAD(pipeline_list, pipeline);
184 pipeline_find(const char *name);
187 pipeline_create(const char *name, struct pipeline_params *params);
190 pipeline_port_in_create(const char *pipeline_name,
191 struct port_in_params *params,
195 pipeline_port_in_connect_to_table(const char *pipeline_name,
200 pipeline_port_out_create(const char *pipeline_name,
201 struct port_out_params *params);
204 pipeline_table_create(const char *pipeline_name,
205 struct table_params *params);
207 struct table_rule_match_acl {
234 struct table_rule_match_array {
238 #ifndef TABLE_RULE_MATCH_SIZE_MAX
239 #define TABLE_RULE_MATCH_SIZE_MAX 256
242 #ifndef TABLE_RULE_ACTION_SIZE_MAX
243 #define TABLE_RULE_ACTION_SIZE_MAX 2048
246 struct table_rule_match_hash {
247 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
250 struct table_rule_match_lpm {
262 struct table_rule_match {
263 enum table_type match_type;
266 struct table_rule_match_acl acl;
267 struct table_rule_match_array array;
268 struct table_rule_match_hash hash;
269 struct table_rule_match_lpm lpm;
273 struct table_rule_action {
274 uint64_t action_mask;
275 struct rte_table_action_fwd_params fwd;
276 struct rte_table_action_lb_params lb;
277 struct rte_table_action_mtr_params mtr;
278 struct rte_table_action_tm_params tm;
279 struct rte_table_action_encap_params encap;
280 struct rte_table_action_nat_params nat;
281 struct rte_table_action_ttl_params ttl;
282 struct rte_table_action_stats_params stats;
283 struct rte_table_action_time_params time;
284 struct rte_table_action_sym_crypto_params sym_crypto;
288 pipeline_port_in_stats_read(const char *pipeline_name,
290 struct rte_pipeline_port_in_stats *stats,
294 pipeline_port_in_enable(const char *pipeline_name,
298 pipeline_port_in_disable(const char *pipeline_name,
302 pipeline_port_out_stats_read(const char *pipeline_name,
304 struct rte_pipeline_port_out_stats *stats,
308 pipeline_table_stats_read(const char *pipeline_name,
310 struct rte_pipeline_table_stats *stats,
314 pipeline_table_rule_add(const char *pipeline_name,
316 struct table_rule_match *match,
317 struct table_rule_action *action,
321 pipeline_table_rule_add_bulk(const char *pipeline_name,
323 struct table_rule_match *match,
324 struct table_rule_action *action,
329 pipeline_table_rule_add_default(const char *pipeline_name,
331 struct table_rule_action *action,
335 pipeline_table_rule_delete(const char *pipeline_name,
337 struct table_rule_match *match);
340 pipeline_table_rule_delete_default(const char *pipeline_name,
344 pipeline_table_rule_stats_read(const char *pipeline_name,
347 struct rte_table_action_stats_counters *stats,
351 pipeline_table_mtr_profile_add(const char *pipeline_name,
353 uint32_t meter_profile_id,
354 struct rte_table_action_meter_profile *profile);
357 pipeline_table_mtr_profile_delete(const char *pipeline_name,
359 uint32_t meter_profile_id);
362 pipeline_table_rule_mtr_read(const char *pipeline_name,
366 struct rte_table_action_mtr_counters *stats,
370 pipeline_table_dscp_table_update(const char *pipeline_name,
373 struct rte_table_action_dscp_table *dscp_table);
376 pipeline_table_rule_ttl_read(const char *pipeline_name,
379 struct rte_table_action_ttl_counters *stats,
382 #endif /* _INCLUDE_PIPELINE_H_ */