DPDK  20.11.0
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
8 extern "C" {
9 #endif
10 
16 #include <stddef.h>
17 #include <stdint.h>
18 
19 #include <rte_compat.h>
20 
21 #include "rte_swx_port.h"
22 #include "rte_swx_table.h"
23 #include "rte_swx_extern.h"
24 
26 #ifndef RTE_SWX_NAME_SIZE
27 #define RTE_SWX_NAME_SIZE 64
28 #endif
29 
31 #ifndef RTE_SWX_INSTRUCTION_SIZE
32 #define RTE_SWX_INSTRUCTION_SIZE 256
33 #endif
34 
36 #ifndef RTE_SWX_INSTRUCTION_TOKENS_MAX
37 #define RTE_SWX_INSTRUCTION_TOKENS_MAX 16
38 #endif
39 
40 /*
41  * Pipeline setup and operation
42  */
43 
45 struct rte_swx_pipeline;
46 
60 __rte_experimental
61 int
62 rte_swx_pipeline_config(struct rte_swx_pipeline **p,
63  int numa_node);
64 
65 /*
66  * Pipeline input ports
67  */
68 
84 __rte_experimental
85 int
86 rte_swx_pipeline_port_in_type_register(struct rte_swx_pipeline *p,
87  const char *name,
88  struct rte_swx_port_in_ops *ops);
89 
107 __rte_experimental
108 int
109 rte_swx_pipeline_port_in_config(struct rte_swx_pipeline *p,
110  uint32_t port_id,
111  const char *port_type_name,
112  void *args);
113 
114 /*
115  * Pipeline output ports
116  */
117 
133 __rte_experimental
134 int
135 rte_swx_pipeline_port_out_type_register(struct rte_swx_pipeline *p,
136  const char *name,
137  struct rte_swx_port_out_ops *ops);
138 
156 __rte_experimental
157 int
158 rte_swx_pipeline_port_out_config(struct rte_swx_pipeline *p,
159  uint32_t port_id,
160  const char *port_type_name,
161  void *args);
162 
163 /*
164  * Extern objects and functions
165  */
166 
189 __rte_experimental
190 int
191 rte_swx_pipeline_extern_type_register(struct rte_swx_pipeline *p,
192  const char *name,
193  const char *mailbox_struct_type_name,
196 
215 __rte_experimental
216 int
217 rte_swx_pipeline_extern_type_member_func_register(struct rte_swx_pipeline *p,
218  const char *extern_type_name,
219  const char *name,
221 
242 __rte_experimental
243 int
244 rte_swx_pipeline_extern_object_config(struct rte_swx_pipeline *p,
245  const char *extern_type_name,
246  const char *name,
247  const char *args);
248 
268 __rte_experimental
269 int
270 rte_swx_pipeline_extern_func_register(struct rte_swx_pipeline *p,
271  const char *name,
272  const char *mailbox_struct_type_name,
273  rte_swx_extern_func_t func);
274 
275 /*
276  * Packet headers and meta-data
277  */
278 
282  const char *name;
283 
288  uint32_t n_bits;
289 };
290 
314 __rte_experimental
315 int
316 rte_swx_pipeline_struct_type_register(struct rte_swx_pipeline *p,
317  const char *name,
318  struct rte_swx_field_params *fields,
319  uint32_t n_fields);
320 
337 __rte_experimental
338 int
339 rte_swx_pipeline_packet_header_register(struct rte_swx_pipeline *p,
340  const char *name,
341  const char *struct_type_name);
342 
354 __rte_experimental
355 int
356 rte_swx_pipeline_packet_metadata_register(struct rte_swx_pipeline *p,
357  const char *struct_type_name);
358 
359 /*
360  * Instructions
361  */
362 
468 /*
469  * Pipeline action
470  */
471 
493 __rte_experimental
494 int
495 rte_swx_pipeline_action_config(struct rte_swx_pipeline *p,
496  const char *name,
497  const char *args_struct_type_name,
498  const char **instructions,
499  uint32_t n_instructions);
500 
501 /*
502  * Pipeline table
503  */
504 
522 __rte_experimental
523 int
524 rte_swx_pipeline_table_type_register(struct rte_swx_pipeline *p,
525  const char *name,
526  enum rte_swx_table_match_type match_type,
527  struct rte_swx_table_ops *ops);
528 
535  const char *name;
536 
538  enum rte_swx_table_match_type match_type;
539 };
540 
549 
555  uint32_t n_fields;
556 
558  const char **action_names;
559 
562  uint32_t n_actions;
563 
567  const char *default_action_name;
568 
574 
581 };
582 
609 __rte_experimental
610 int
611 rte_swx_pipeline_table_config(struct rte_swx_pipeline *p,
612  const char *name,
613  struct rte_swx_pipeline_table_params *params,
614  const char *recommended_table_type_name,
615  const char *args,
616  uint32_t size);
617 
632 __rte_experimental
633 int
634 rte_swx_pipeline_instructions_config(struct rte_swx_pipeline *p,
635  const char **instructions,
636  uint32_t n_instructions);
637 
653 __rte_experimental
654 int
655 rte_swx_pipeline_build(struct rte_swx_pipeline *p);
656 
676 __rte_experimental
677 int
678 rte_swx_pipeline_build_from_spec(struct rte_swx_pipeline *p,
679  FILE *spec,
680  uint32_t *err_line,
681  const char **err_msg);
682 
691 __rte_experimental
692 void
693 rte_swx_pipeline_run(struct rte_swx_pipeline *p,
694  uint32_t n_instructions);
695 
704 __rte_experimental
705 void
706 rte_swx_pipeline_flush(struct rte_swx_pipeline *p);
707 
714 __rte_experimental
715 void
716 rte_swx_pipeline_free(struct rte_swx_pipeline *p);
717 
718 #ifdef __cplusplus
719 }
720 #endif
721 
722 #endif
__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)
int(* rte_swx_extern_func_t)(void *mailbox)
__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_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_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_struct_type_register(struct rte_swx_pipeline *p, const char *name, struct rte_swx_field_params *fields, uint32_t n_fields)
__rte_experimental void rte_swx_pipeline_run(struct rte_swx_pipeline *p, uint32_t n_instructions)
struct rte_swx_match_field_params * fields
__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_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_swx_table_match_type
Definition: rte_swx_table.h:22
__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 void rte_swx_pipeline_free(struct rte_swx_pipeline *p)
void(* rte_swx_extern_type_destructor_t)(void *object)
__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 void rte_swx_pipeline_flush(struct rte_swx_pipeline *p)
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_packet_metadata_register(struct rte_swx_pipeline *p, const char *struct_type_name)
__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_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_action_config(struct rte_swx_pipeline *p, const char *name, const char *args_struct_type_name, const char **instructions, uint32_t n_instructions)
int(* rte_swx_extern_type_member_func_t)(void *object, void *mailbox)
__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_extern_func_register(struct rte_swx_pipeline *p, const char *name, const char *mailbox_struct_type_name, rte_swx_extern_func_t func)