DPDK 25.03.0-rc0
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
12#include <stdint.h>
13#include <stdio.h>
14
15#include <rte_compat.h>
16
17#include "rte_swx_port.h"
18#include "rte_swx_table.h"
19#include "rte_swx_extern.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
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 * RSS.
357 */
358
372__rte_experimental
373int
374rte_swx_pipeline_rss_config(struct rte_swx_pipeline *p,
375 const char *name);
376
377/*
378 * Packet headers and meta-data
379 */
380
384 const char *name;
385
390 uint32_t n_bits;
391};
392
428__rte_experimental
429int
430rte_swx_pipeline_struct_type_register(struct rte_swx_pipeline *p,
431 const char *name,
432 struct rte_swx_field_params *fields,
433 uint32_t n_fields,
434 int last_field_has_variable_size);
435
452__rte_experimental
453int
455 const char *name,
456 const char *struct_type_name);
457
469__rte_experimental
470int
472 const char *struct_type_name);
473
474/*
475 * Instructions
476 */
477
579/*
580 * Pipeline action
581 */
582
604__rte_experimental
605int
606rte_swx_pipeline_action_config(struct rte_swx_pipeline *p,
607 const char *name,
608 const char *args_struct_type_name,
609 const char **instructions,
610 uint32_t n_instructions);
611
612/*
613 * Pipeline table
614 */
615
633__rte_experimental
634int
635rte_swx_pipeline_table_type_register(struct rte_swx_pipeline *p,
636 const char *name,
637 enum rte_swx_table_match_type match_type,
638 struct rte_swx_table_ops *ops);
639
646 const char *name;
647
650};
651
660
666 uint32_t n_fields;
667
669 const char **action_names;
670
677
684
687 uint32_t n_actions;
688
693
700
707
713 const char *hash_func_name;
714};
715
742__rte_experimental
743int
744rte_swx_pipeline_table_config(struct rte_swx_pipeline *p,
745 const char *name,
746 struct rte_swx_pipeline_table_params *params,
747 const char *recommended_table_type_name,
748 const char *args,
749 uint32_t size);
750
757
764
767
772
774 uint32_t n_groups_max;
775
778};
779
796__rte_experimental
797int
798rte_swx_pipeline_selector_config(struct rte_swx_pipeline *p,
799 const char *name,
800 struct rte_swx_pipeline_selector_params *params);
801
809 const char **field_names;
810
813 uint32_t n_fields;
814
816 const char **action_names;
817
824
831
834 uint32_t n_actions;
835
840
847
854
859 const char *hash_func_name;
860};
861
884__rte_experimental
885int
886rte_swx_pipeline_learner_config(struct rte_swx_pipeline *p,
887 const char *name,
888 struct rte_swx_pipeline_learner_params *params,
889 uint32_t size,
890 uint32_t *timeout,
891 uint32_t n_timeouts);
892
910__rte_experimental
911int
912rte_swx_pipeline_regarray_config(struct rte_swx_pipeline *p,
913 const char *name,
914 uint32_t size,
915 uint64_t init_val);
916
933__rte_experimental
934int
935rte_swx_pipeline_metarray_config(struct rte_swx_pipeline *p,
936 const char *name,
937 uint32_t size);
938
953__rte_experimental
954int
955rte_swx_pipeline_instructions_config(struct rte_swx_pipeline *p,
956 const char **instructions,
957 uint32_t n_instructions);
958
974__rte_experimental
975int
976rte_swx_pipeline_build(struct rte_swx_pipeline *p);
977
996__rte_experimental
997int
999 FILE *code_file,
1000 uint32_t *err_line,
1001 const char **err_msg);
1002
1029__rte_experimental
1030int
1031rte_swx_pipeline_build_from_lib(struct rte_swx_pipeline **p,
1032 const char *name,
1033 const char *lib_file_name,
1034 FILE *iospec_file,
1035 int numa_node);
1036
1045__rte_experimental
1046void
1047rte_swx_pipeline_run(struct rte_swx_pipeline *p,
1048 uint32_t n_instructions);
1049
1059__rte_experimental
1060void
1061rte_swx_pipeline_flush(struct rte_swx_pipeline *p);
1062
1069__rte_experimental
1070void
1071rte_swx_pipeline_free(struct rte_swx_pipeline *p);
1072
1073#ifdef __cplusplus
1074}
1075#endif
1076
1077#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_rss_config(struct rte_swx_pipeline *p, const char *name)
__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:21
enum rte_swx_table_match_type match_type
struct rte_swx_match_field_params * fields