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_lb_params lb;
264 struct rte_table_action_mtr_params mtr;
265 struct rte_table_action_tm_params tm;
266 struct rte_table_action_encap_params encap;
267 struct rte_table_action_nat_params nat;
268 struct rte_table_action_ttl_params ttl;
269 struct rte_table_action_stats_params stats;
270 struct rte_table_action_time_params time;
274 pipeline_port_in_stats_read(const char *pipeline_name,
276 struct rte_pipeline_port_in_stats *stats,
280 pipeline_port_in_enable(const char *pipeline_name,
284 pipeline_port_in_disable(const char *pipeline_name,
288 pipeline_port_out_stats_read(const char *pipeline_name,
290 struct rte_pipeline_port_out_stats *stats,
294 pipeline_table_stats_read(const char *pipeline_name,
296 struct rte_pipeline_table_stats *stats,
300 pipeline_table_rule_add(const char *pipeline_name,
302 struct table_rule_match *match,
303 struct table_rule_action *action,
307 pipeline_table_rule_add_bulk(const char *pipeline_name,
309 struct table_rule_match *match,
310 struct table_rule_action *action,
315 pipeline_table_rule_add_default(const char *pipeline_name,
317 struct table_rule_action *action,
321 pipeline_table_rule_delete(const char *pipeline_name,
323 struct table_rule_match *match);
326 pipeline_table_rule_delete_default(const char *pipeline_name,
330 pipeline_table_rule_stats_read(const char *pipeline_name,
333 struct rte_table_action_stats_counters *stats,
337 pipeline_table_mtr_profile_add(const char *pipeline_name,
339 uint32_t meter_profile_id,
340 struct rte_table_action_meter_profile *profile);
343 pipeline_table_mtr_profile_delete(const char *pipeline_name,
345 uint32_t meter_profile_id);
348 pipeline_table_rule_mtr_read(const char *pipeline_name,
352 struct rte_table_action_mtr_counters *stats,
356 pipeline_table_dscp_table_update(const char *pipeline_name,
359 struct rte_table_action_dscp_table *dscp_table);
362 pipeline_table_rule_ttl_read(const char *pipeline_name,
365 struct rte_table_action_ttl_counters *stats,
368 #endif /* _INCLUDE_PIPELINE_H_ */