DPDK 21.11.9
rte_swx_pipeline.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Intel Corporation
3 */
4#ifndef __INCLUDE_RTE_SWX_PIPELINE_H__
5#define __INCLUDE_RTE_SWX_PIPELINE_H__
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
16#include <stddef.h>
17#include <stdint.h>
18#include <stdio.h>
19
20#include <rte_compat.h>
21
22#include "rte_swx_port.h"
23#include "rte_swx_table.h"
24#include "rte_swx_extern.h"
25
27#ifndef RTE_SWX_NAME_SIZE
28#define RTE_SWX_NAME_SIZE 64
29#endif
30
32#ifndef RTE_SWX_INSTRUCTION_SIZE
33#define RTE_SWX_INSTRUCTION_SIZE 256
34#endif
35
37#ifndef RTE_SWX_INSTRUCTION_TOKENS_MAX
38#define RTE_SWX_INSTRUCTION_TOKENS_MAX 16
39#endif
40
41/*
42 * Pipeline setup and operation
43 */
44
46struct rte_swx_pipeline;
47
61__rte_experimental
62int
63rte_swx_pipeline_config(struct rte_swx_pipeline **p,
64 int numa_node);
65
66/*
67 * Pipeline input ports
68 */
69
85__rte_experimental
86int
87rte_swx_pipeline_port_in_type_register(struct rte_swx_pipeline *p,
88 const char *name,
89 struct rte_swx_port_in_ops *ops);
90
108__rte_experimental
109int
110rte_swx_pipeline_port_in_config(struct rte_swx_pipeline *p,
111 uint32_t port_id,
112 const char *port_type_name,
113 void *args);
114
115/*
116 * Pipeline output ports
117 */
118
134__rte_experimental
135int
137 const char *name,
138 struct rte_swx_port_out_ops *ops);
139
157__rte_experimental
158int
159rte_swx_pipeline_port_out_config(struct rte_swx_pipeline *p,
160 uint32_t port_id,
161 const char *port_type_name,
162 void *args);
163
164/*
165 * Extern objects and functions
166 */
167
190__rte_experimental
191int
192rte_swx_pipeline_extern_type_register(struct rte_swx_pipeline *p,
193 const char *name,
194 const char *mailbox_struct_type_name,
197
216__rte_experimental
217int
219 const char *extern_type_name,
220 const char *name,
222
243__rte_experimental
244int
245rte_swx_pipeline_extern_object_config(struct rte_swx_pipeline *p,
246 const char *extern_type_name,
247 const char *name,
248 const char *args);
249
269__rte_experimental
270int
271rte_swx_pipeline_extern_func_register(struct rte_swx_pipeline *p,
272 const char *name,
273 const char *mailbox_struct_type_name,
275
276/*
277 * Packet headers and meta-data
278 */
279
283 const char *name;
284
289 uint32_t n_bits;
290};
291
327__rte_experimental
328int
329rte_swx_pipeline_struct_type_register(struct rte_swx_pipeline *p,
330 const char *name,
331 struct rte_swx_field_params *fields,
332 uint32_t n_fields,
333 int last_field_has_variable_size);
334
351__rte_experimental
352int
354 const char *name,
355 const char *struct_type_name);
356
368__rte_experimental
369int
371 const char *struct_type_name);
372
373/*
374 * Instructions
375 */
376
478/*
479 * Pipeline action
480 */
481
503__rte_experimental
504int
505rte_swx_pipeline_action_config(struct rte_swx_pipeline *p,
506 const char *name,
507 const char *args_struct_type_name,
508 const char **instructions,
509 uint32_t n_instructions);
510
511/*
512 * Pipeline table
513 */
514
532__rte_experimental
533int
534rte_swx_pipeline_table_type_register(struct rte_swx_pipeline *p,
535 const char *name,
536 enum rte_swx_table_match_type match_type,
537 struct rte_swx_table_ops *ops);
538
545 const char *name;
546
549};
550
559
565 uint32_t n_fields;
566
568 const char **action_names;
569
576
583
586 uint32_t n_actions;
587
592
598
605};
606
633__rte_experimental
634int
635rte_swx_pipeline_table_config(struct rte_swx_pipeline *p,
636 const char *name,
637 struct rte_swx_pipeline_table_params *params,
638 const char *recommended_table_type_name,
639 const char *args,
640 uint32_t size);
641
648
655
658
663
665 uint32_t n_groups_max;
666
669};
670
687__rte_experimental
688int
689rte_swx_pipeline_selector_config(struct rte_swx_pipeline *p,
690 const char *name,
691 struct rte_swx_pipeline_selector_params *params);
692
700 const char **field_names;
701
704 uint32_t n_fields;
705
707 const char **action_names;
708
715
722
725 uint32_t n_actions;
726
731
737
744};
745
766__rte_experimental
767int
768rte_swx_pipeline_learner_config(struct rte_swx_pipeline *p,
769 const char *name,
770 struct rte_swx_pipeline_learner_params *params,
771 uint32_t size,
772 uint32_t timeout);
773
791__rte_experimental
792int
793rte_swx_pipeline_regarray_config(struct rte_swx_pipeline *p,
794 const char *name,
795 uint32_t size,
796 uint64_t init_val);
797
814__rte_experimental
815int
816rte_swx_pipeline_metarray_config(struct rte_swx_pipeline *p,
817 const char *name,
818 uint32_t size);
819
834__rte_experimental
835int
836rte_swx_pipeline_instructions_config(struct rte_swx_pipeline *p,
837 const char **instructions,
838 uint32_t n_instructions);
839
855__rte_experimental
856int
857rte_swx_pipeline_build(struct rte_swx_pipeline *p);
858
878__rte_experimental
879int
880rte_swx_pipeline_build_from_spec(struct rte_swx_pipeline *p,
881 FILE *spec,
882 uint32_t *err_line,
883 const char **err_msg);
884
893__rte_experimental
894void
895rte_swx_pipeline_run(struct rte_swx_pipeline *p,
896 uint32_t n_instructions);
897
906__rte_experimental
907void
908rte_swx_pipeline_flush(struct rte_swx_pipeline *p);
909
916__rte_experimental
917void
918rte_swx_pipeline_free(struct rte_swx_pipeline *p);
919
920#ifdef __cplusplus
921}
922#endif
923
924#endif
void(* rte_swx_extern_type_destructor_t)(void *object)
int(* rte_swx_extern_func_t)(void *mailbox)
int(* rte_swx_extern_type_member_func_t)(void *object, void *mailbox)
void *(* rte_swx_extern_type_constructor_t)(const char *args)
__rte_experimental int rte_swx_pipeline_build(struct rte_swx_pipeline *p)
__rte_experimental int rte_swx_pipeline_learner_config(struct rte_swx_pipeline *p, const char *name, struct rte_swx_pipeline_learner_params *params, uint32_t size, uint32_t timeout)
__rte_experimental int rte_swx_pipeline_build_from_spec(struct rte_swx_pipeline *p, FILE *spec, uint32_t *err_line, const char **err_msg)
__rte_experimental int rte_swx_pipeline_extern_type_member_func_register(struct rte_swx_pipeline *p, const char *extern_type_name, const char *name, rte_swx_extern_type_member_func_t member_func)
__rte_experimental int rte_swx_pipeline_port_in_type_register(struct rte_swx_pipeline *p, const char *name, struct rte_swx_port_in_ops *ops)
__rte_experimental int rte_swx_pipeline_instructions_config(struct rte_swx_pipeline *p, const char **instructions, uint32_t n_instructions)
__rte_experimental int rte_swx_pipeline_port_out_config(struct rte_swx_pipeline *p, uint32_t port_id, const char *port_type_name, void *args)
__rte_experimental int rte_swx_pipeline_packet_metadata_register(struct rte_swx_pipeline *p, const char *struct_type_name)
__rte_experimental int rte_swx_pipeline_table_config(struct rte_swx_pipeline *p, const char *name, struct rte_swx_pipeline_table_params *params, const char *recommended_table_type_name, const char *args, uint32_t size)
__rte_experimental int rte_swx_pipeline_port_in_config(struct rte_swx_pipeline *p, uint32_t port_id, const char *port_type_name, void *args)
__rte_experimental int rte_swx_pipeline_regarray_config(struct rte_swx_pipeline *p, const char *name, uint32_t size, uint64_t init_val)
__rte_experimental int rte_swx_pipeline_port_out_type_register(struct rte_swx_pipeline *p, const char *name, struct rte_swx_port_out_ops *ops)
__rte_experimental int rte_swx_pipeline_table_type_register(struct rte_swx_pipeline *p, const char *name, enum rte_swx_table_match_type match_type, struct rte_swx_table_ops *ops)
__rte_experimental int rte_swx_pipeline_extern_object_config(struct rte_swx_pipeline *p, const char *extern_type_name, const char *name, const char *args)
__rte_experimental int rte_swx_pipeline_packet_header_register(struct rte_swx_pipeline *p, const char *name, const char *struct_type_name)
__rte_experimental int rte_swx_pipeline_config(struct rte_swx_pipeline **p, int numa_node)
__rte_experimental int rte_swx_pipeline_selector_config(struct rte_swx_pipeline *p, const char *name, struct rte_swx_pipeline_selector_params *params)
__rte_experimental void rte_swx_pipeline_flush(struct rte_swx_pipeline *p)
__rte_experimental void rte_swx_pipeline_run(struct rte_swx_pipeline *p, uint32_t n_instructions)
__rte_experimental void rte_swx_pipeline_free(struct rte_swx_pipeline *p)
__rte_experimental int rte_swx_pipeline_struct_type_register(struct rte_swx_pipeline *p, const char *name, struct rte_swx_field_params *fields, uint32_t n_fields, int last_field_has_variable_size)
__rte_experimental int rte_swx_pipeline_extern_type_register(struct rte_swx_pipeline *p, const char *name, const char *mailbox_struct_type_name, rte_swx_extern_type_constructor_t constructor, rte_swx_extern_type_destructor_t destructor)
__rte_experimental int rte_swx_pipeline_action_config(struct rte_swx_pipeline *p, const char *name, const char *args_struct_type_name, const char **instructions, uint32_t n_instructions)
__rte_experimental int rte_swx_pipeline_extern_func_register(struct rte_swx_pipeline *p, const char *name, const char *mailbox_struct_type_name, rte_swx_extern_func_t func)
__rte_experimental int rte_swx_pipeline_metarray_config(struct rte_swx_pipeline *p, const char *name, uint32_t size)
rte_swx_table_match_type
Definition: rte_swx_table.h:23
enum rte_swx_table_match_type match_type
struct rte_swx_match_field_params * fields