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
;
148 TAILQ_HEAD(table_rule_list
, table_rule
);
151 struct port_in_params params
;
152 struct port_in_action_profile
*ap
;
153 struct rte_port_in_action
*a
;
157 struct table_params params
;
158 struct table_action_profile
*ap
;
159 struct rte_table_action
*a
;
160 struct table_rule_list rules
;
161 struct table_rule
*rule_default
;
165 TAILQ_ENTRY(pipeline
) node
;
166 char name
[NAME_SIZE
];
168 struct rte_pipeline
*p
;
169 struct port_in port_in
[RTE_PIPELINE_PORT_IN_MAX
];
170 struct table table
[RTE_PIPELINE_TABLE_MAX
];
172 uint32_t n_ports_out
;
175 struct rte_ring
*msgq_req
;
176 struct rte_ring
*msgq_rsp
;
177 uint32_t timer_period_ms
;
184 TAILQ_HEAD(pipeline_list
, pipeline
);
190 pipeline_find(const char *name
);
193 pipeline_create(const char *name
, struct pipeline_params
*params
);
196 pipeline_port_in_create(const char *pipeline_name
,
197 struct port_in_params
*params
,
201 pipeline_port_in_connect_to_table(const char *pipeline_name
,
206 pipeline_port_out_create(const char *pipeline_name
,
207 struct port_out_params
*params
);
210 pipeline_table_create(const char *pipeline_name
,
211 struct table_params
*params
);
213 struct table_rule_match_acl
{
240 struct table_rule_match_array
{
244 #ifndef TABLE_RULE_MATCH_SIZE_MAX
245 #define TABLE_RULE_MATCH_SIZE_MAX 256
248 #ifndef TABLE_RULE_ACTION_SIZE_MAX
249 #define TABLE_RULE_ACTION_SIZE_MAX 2048
252 struct table_rule_match_hash
{
253 uint8_t key
[TABLE_RULE_MATCH_SIZE_MAX
];
256 struct table_rule_match_lpm
{
268 struct table_rule_match
{
269 enum table_type match_type
;
272 struct table_rule_match_acl acl
;
273 struct table_rule_match_array array
;
274 struct table_rule_match_hash hash
;
275 struct table_rule_match_lpm lpm
;
279 struct table_rule_action
{
280 uint64_t action_mask
;
281 struct rte_table_action_fwd_params fwd
;
282 struct rte_table_action_lb_params lb
;
283 struct rte_table_action_mtr_params mtr
;
284 struct rte_table_action_tm_params tm
;
285 struct rte_table_action_encap_params encap
;
286 struct rte_table_action_nat_params nat
;
287 struct rte_table_action_ttl_params ttl
;
288 struct rte_table_action_stats_params stats
;
289 struct rte_table_action_time_params time
;
290 struct rte_table_action_sym_crypto_params sym_crypto
;
291 struct rte_table_action_tag_params tag
;
292 struct rte_table_action_decap_params decap
;
296 TAILQ_ENTRY(table_rule
) node
;
297 struct table_rule_match match
;
298 struct table_rule_action action
;
303 pipeline_port_in_stats_read(const char *pipeline_name
,
305 struct rte_pipeline_port_in_stats
*stats
,
309 pipeline_port_in_enable(const char *pipeline_name
,
313 pipeline_port_in_disable(const char *pipeline_name
,
317 pipeline_port_out_stats_read(const char *pipeline_name
,
319 struct rte_pipeline_port_out_stats
*stats
,
323 pipeline_table_stats_read(const char *pipeline_name
,
325 struct rte_pipeline_table_stats
*stats
,
329 pipeline_table_rule_add(const char *pipeline_name
,
331 struct table_rule_match
*match
,
332 struct table_rule_action
*action
);
335 pipeline_table_rule_add_bulk(const char *pipeline_name
,
337 struct table_rule_list
*list
,
338 uint32_t *n_rules_added
,
339 uint32_t *n_rules_not_added
);
342 pipeline_table_rule_add_default(const char *pipeline_name
,
344 struct table_rule_action
*action
);
347 pipeline_table_rule_delete(const char *pipeline_name
,
349 struct table_rule_match
*match
);
352 pipeline_table_rule_delete_default(const char *pipeline_name
,
356 pipeline_table_rule_stats_read(const char *pipeline_name
,
358 struct table_rule_match
*match
,
359 struct rte_table_action_stats_counters
*stats
,
363 pipeline_table_mtr_profile_add(const char *pipeline_name
,
365 uint32_t meter_profile_id
,
366 struct rte_table_action_meter_profile
*profile
);
369 pipeline_table_mtr_profile_delete(const char *pipeline_name
,
371 uint32_t meter_profile_id
);
374 pipeline_table_rule_mtr_read(const char *pipeline_name
,
376 struct table_rule_match
*match
,
377 struct rte_table_action_mtr_counters
*stats
,
381 pipeline_table_dscp_table_update(const char *pipeline_name
,
384 struct rte_table_action_dscp_table
*dscp_table
);
387 pipeline_table_rule_ttl_read(const char *pipeline_name
,
389 struct table_rule_match
*match
,
390 struct rte_table_action_ttl_counters
*stats
,
394 pipeline_table_rule_time_read(const char *pipeline_name
,
396 struct table_rule_match
*match
,
397 uint64_t *timestamp
);
400 table_rule_find(struct table
*table
,
401 struct table_rule_match
*match
);
404 table_rule_add(struct table
*table
,
405 struct table_rule
*rule
);
408 table_rule_add_bulk(struct table
*table
,
409 struct table_rule_list
*list
,
413 table_rule_delete(struct table
*table
,
414 struct table_rule_match
*match
);
417 table_rule_default_add(struct table
*table
,
418 struct table_rule
*rule
);
421 table_rule_default_delete(struct table
*table
);
423 #endif /* _INCLUDE_PIPELINE_H_ */