DPDK 22.11.5
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 <stdint.h>
17#include <stdio.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
45struct rte_swx_pipeline;
46
55__rte_experimental
56struct rte_swx_pipeline *
57rte_swx_pipeline_find(const char *name);
58
75__rte_experimental
76int
77rte_swx_pipeline_config(struct rte_swx_pipeline **p,
78 const char *name,
79 int numa_node);
80
81/*
82 * Pipeline input ports
83 */
84
100__rte_experimental
101int
102rte_swx_pipeline_port_in_type_register(struct rte_swx_pipeline *p,
103 const char *name,
104 struct rte_swx_port_in_ops *ops);
105
123__rte_experimental
124int
125rte_swx_pipeline_port_in_config(struct rte_swx_pipeline *p,
126 uint32_t port_id,
127 const char *port_type_name,
128 void *args);
129
130/*
131 * Pipeline output ports
132 */
133
149__rte_experimental
150int
152 const char *name,
153 struct rte_swx_port_out_ops *ops);
154
172__rte_experimental
173int
174rte_swx_pipeline_port_out_config(struct rte_swx_pipeline *p,
175 uint32_t port_id,
176 const char *port_type_name,
177 void *args);
178/*
179 * Packet mirroring
180 */
181
183#ifndef RTE_SWX_PACKET_MIRRORING_SLOTS_DEFAULT
184#define RTE_SWX_PACKET_MIRRORING_SLOTS_DEFAULT 4
185#endif
186
188#ifndef RTE_SWX_PACKET_MIRRORING_SESSIONS_DEFAULT
189#define RTE_SWX_PACKET_MIRRORING_SESSIONS_DEFAULT 64
190#endif
191
195 uint32_t n_slots;
196
198 uint32_t n_sessions;
199};
200
214__rte_experimental
215int
216rte_swx_pipeline_mirroring_config(struct rte_swx_pipeline *p,
217 struct rte_swx_pipeline_mirroring_params *params);
218
219/*
220 * Extern objects and functions
221 */
222
245__rte_experimental
246int
247rte_swx_pipeline_extern_type_register(struct rte_swx_pipeline *p,
248 const char *name,
249 const char *mailbox_struct_type_name,
252
271__rte_experimental
272int
274 const char *extern_type_name,
275 const char *name,
277
298__rte_experimental
299int
300rte_swx_pipeline_extern_object_config(struct rte_swx_pipeline *p,
301 const char *extern_type_name,
302 const char *name,
303 const char *args);
304
324__rte_experimental
325int
326rte_swx_pipeline_extern_func_register(struct rte_swx_pipeline *p,
327 const char *name,
328 const char *mailbox_struct_type_name,
330/*
331 * Hash function.
332 */
333
349__rte_experimental
350int
351rte_swx_pipeline_hash_func_register(struct rte_swx_pipeline *p,
352 const char *name,
354
355/*
356 * Packet headers and meta-data
357 */
358
362 const char *name;
363
368 uint32_t n_bits;
369};
370
406__rte_experimental
407int
408rte_swx_pipeline_struct_type_register(struct rte_swx_pipeline *p,
409 const char *name,
410 struct rte_swx_field_params *fields,
411 uint32_t n_fields,
412 int last_field_has_variable_size);
413
430__rte_experimental
431int
433 const char *name,
434 const char *struct_type_name);
435
447__rte_experimental
448int
450 const char *struct_type_name);
451
452/*
453 * Instructions
454 */
455
557/*
558 * Pipeline action
559 */
560
582__rte_experimental
583int
584rte_swx_pipeline_action_config(struct rte_swx_pipeline *p,
585 const char *name,
586 const char *args_struct_type_name,
587 const char **instructions,
588 uint32_t n_instructions);
589
590/*
591 * Pipeline table
592 */
593
611__rte_experimental
612int
613rte_swx_pipeline_table_type_register(struct rte_swx_pipeline *p,
614 const char *name,
615 enum rte_swx_table_match_type match_type,
616 struct rte_swx_table_ops *ops);
617
624 const char *name;
625
628};
629
638
644 uint32_t n_fields;
645
647 const char **action_names;
648
655
662
665 uint32_t n_actions;
666
671
678
685
691 const char *hash_func_name;
692};
693
720__rte_experimental
721int
722rte_swx_pipeline_table_config(struct rte_swx_pipeline *p,
723 const char *name,
724 struct rte_swx_pipeline_table_params *params,
725 const char *recommended_table_type_name,
726 const char *args,
727 uint32_t size);
728
735
742
745
750
752 uint32_t n_groups_max;
753
756};
757
774__rte_experimental
775int
776rte_swx_pipeline_selector_config(struct rte_swx_pipeline *p,
777 const char *name,
778 struct rte_swx_pipeline_selector_params *params);
779
787 const char **field_names;
788
791 uint32_t n_fields;
792
794 const char **action_names;
795
802
809
812 uint32_t n_actions;
813
818
825
832
837 const char *hash_func_name;
838};
839
862__rte_experimental
863int
864rte_swx_pipeline_learner_config(struct rte_swx_pipeline *p,
865 const char *name,
866 struct rte_swx_pipeline_learner_params *params,
867 uint32_t size,
868 uint32_t *timeout,
869 uint32_t n_timeouts);
870
888__rte_experimental
889int
890rte_swx_pipeline_regarray_config(struct rte_swx_pipeline *p,
891 const char *name,
892 uint32_t size,
893 uint64_t init_val);
894
911__rte_experimental
912int
913rte_swx_pipeline_metarray_config(struct rte_swx_pipeline *p,
914 const char *name,
915 uint32_t size);
916
931__rte_experimental
932int
933rte_swx_pipeline_instructions_config(struct rte_swx_pipeline *p,
934 const char **instructions,
935 uint32_t n_instructions);
936
952__rte_experimental
953int
954rte_swx_pipeline_build(struct rte_swx_pipeline *p);
955
974__rte_experimental
975int
977 FILE *code_file,
978 uint32_t *err_line,
979 const char **err_msg);
980
1007__rte_experimental
1008int
1009rte_swx_pipeline_build_from_lib(struct rte_swx_pipeline **p,
1010 const char *name,
1011 const char *lib_file_name,
1012 FILE *iospec_file,
1013 int numa_node);
1014
1023__rte_experimental
1024void
1025rte_swx_pipeline_run(struct rte_swx_pipeline *p,
1026 uint32_t n_instructions);
1027
1037__rte_experimental
1038void
1039rte_swx_pipeline_flush(struct rte_swx_pipeline *p);
1040
1047__rte_experimental
1048void
1049rte_swx_pipeline_free(struct rte_swx_pipeline *p);
1050
1051#ifdef __cplusplus
1052}
1053#endif
1054
1055#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)
uint32_t(* rte_swx_hash_func_t)(const void *key, uint32_t length, uint32_t seed)
__rte_experimental int rte_swx_pipeline_build(struct rte_swx_pipeline *p)
__rte_experimental int rte_swx_pipeline_build_from_lib(struct rte_swx_pipeline **p, const char *name, const char *lib_file_name, FILE *iospec_file, int numa_node)
__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_mirroring_config(struct rte_swx_pipeline *p, struct rte_swx_pipeline_mirroring_params *params)
__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_config(struct rte_swx_pipeline **p, const char *name, int numa_node)
__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 struct rte_swx_pipeline * rte_swx_pipeline_find(const char *name)
__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_selector_config(struct rte_swx_pipeline *p, const char *name, struct rte_swx_pipeline_selector_params *params)
__rte_experimental int rte_swx_pipeline_hash_func_register(struct rte_swx_pipeline *p, const char *name, rte_swx_hash_func_t func)
__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_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, uint32_t n_timeouts)
__rte_experimental int rte_swx_pipeline_codegen(FILE *spec_file, FILE *code_file, uint32_t *err_line, const char **err_msg)
rte_swx_table_match_type
Definition: rte_swx_table.h:25
enum rte_swx_table_match_type match_type
struct rte_swx_match_field_params * fields