DPDK 22.11.7
Data Structures | Macros | Functions
rte_swx_pipeline.h File Reference
#include <stdint.h>
#include <stdio.h>
#include <rte_compat.h>
#include "rte_swx_port.h"
#include "rte_swx_table.h"
#include "rte_swx_extern.h"

Go to the source code of this file.

Data Structures

struct  rte_swx_pipeline_mirroring_params
 
struct  rte_swx_field_params
 
struct  rte_swx_match_field_params
 
struct  rte_swx_pipeline_table_params
 
struct  rte_swx_pipeline_selector_params
 
struct  rte_swx_pipeline_learner_params
 

Macros

#define RTE_SWX_NAME_SIZE   64
 
#define RTE_SWX_INSTRUCTION_SIZE   256
 
#define RTE_SWX_INSTRUCTION_TOKENS_MAX   16
 
#define RTE_SWX_PACKET_MIRRORING_SLOTS_DEFAULT   4
 
#define RTE_SWX_PACKET_MIRRORING_SESSIONS_DEFAULT   64
 

Functions

__rte_experimental struct rte_swx_pipeline * rte_swx_pipeline_find (const char *name)
 
__rte_experimental int rte_swx_pipeline_config (struct rte_swx_pipeline **p, const char *name, int numa_node)
 
__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_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_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_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_mirroring_config (struct rte_swx_pipeline *p, struct rte_swx_pipeline_mirroring_params *params)
 
__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_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_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_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_hash_func_register (struct rte_swx_pipeline *p, const char *name, rte_swx_hash_func_t func)
 
__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_packet_header_register (struct rte_swx_pipeline *p, const char *name, const char *struct_type_name)
 
__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_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_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_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_selector_config (struct rte_swx_pipeline *p, const char *name, struct rte_swx_pipeline_selector_params *params)
 
__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_regarray_config (struct rte_swx_pipeline *p, const char *name, uint32_t size, uint64_t init_val)
 
__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_instructions_config (struct rte_swx_pipeline *p, const char **instructions, uint32_t n_instructions)
 
__rte_experimental int rte_swx_pipeline_build (struct rte_swx_pipeline *p)
 
__rte_experimental int rte_swx_pipeline_codegen (FILE *spec_file, FILE *code_file, uint32_t *err_line, const char **err_msg)
 
__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 void rte_swx_pipeline_run (struct rte_swx_pipeline *p, uint32_t n_instructions)
 
__rte_experimental void rte_swx_pipeline_flush (struct rte_swx_pipeline *p)
 
__rte_experimental void rte_swx_pipeline_free (struct rte_swx_pipeline *p)
 

Detailed Description

RTE SWX Pipeline

Definition in file rte_swx_pipeline.h.

Macro Definition Documentation

◆ RTE_SWX_NAME_SIZE

#define RTE_SWX_NAME_SIZE   64

Name size.

Definition at line 27 of file rte_swx_pipeline.h.

◆ RTE_SWX_INSTRUCTION_SIZE

#define RTE_SWX_INSTRUCTION_SIZE   256

Instruction size.

Definition at line 32 of file rte_swx_pipeline.h.

◆ RTE_SWX_INSTRUCTION_TOKENS_MAX

#define RTE_SWX_INSTRUCTION_TOKENS_MAX   16

Instruction tokens.

Definition at line 37 of file rte_swx_pipeline.h.

◆ RTE_SWX_PACKET_MIRRORING_SLOTS_DEFAULT

#define RTE_SWX_PACKET_MIRRORING_SLOTS_DEFAULT   4

Default number of packet mirroring slots.

Definition at line 184 of file rte_swx_pipeline.h.

◆ RTE_SWX_PACKET_MIRRORING_SESSIONS_DEFAULT

#define RTE_SWX_PACKET_MIRRORING_SESSIONS_DEFAULT   64

Default maximum number of packet mirroring sessions.

Definition at line 189 of file rte_swx_pipeline.h.

Function Documentation

◆ rte_swx_pipeline_find()

__rte_experimental struct rte_swx_pipeline * rte_swx_pipeline_find ( const char *  name)

Pipeline find

Parameters
[in]namePipeline name.
Returns
Valid pipeline handle if found or NULL otherwise.
Examples
examples/pipeline/cli.c.

◆ rte_swx_pipeline_config()

__rte_experimental int rte_swx_pipeline_config ( struct rte_swx_pipeline **  p,
const char *  name,
int  numa_node 
)

Pipeline configure

Parameters
[out]pPipeline handle. Must point to valid memory. Contains valid pipeline handle when the function returns successfully.
[in]namePipeline unique name.
[in]numa_nodeNon-Uniform Memory Access (NUMA) node.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Pipeline with this name already exists.

◆ rte_swx_pipeline_port_in_type_register()

__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 
)

Pipeline input port type register

Parameters
[in]pPipeline handle.
[in]nameInput port type name.
[in]opsInput port type operations.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Input port type with this name already exists.

◆ rte_swx_pipeline_port_in_config()

__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 
)

Pipeline input port configure

Parameters
[in]pPipeline handle.
[in]port_idInput port ID.
[in]port_type_nameExisting input port type name.
[in]argsInput port creation arguments.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -ENODEV: Input port object creation error.

◆ rte_swx_pipeline_port_out_type_register()

__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 
)

Pipeline output port type register

Parameters
[in]pPipeline handle.
[in]nameOutput port type name.
[in]opsOutput port type operations.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Output port type with this name already exists.

◆ rte_swx_pipeline_port_out_config()

__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 
)

Pipeline output port configure

Parameters
[in]pPipeline handle.
[in]port_idOutput port ID.
[in]port_type_nameExisting output port type name.
[in]argsOutput port creation arguments.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -ENODEV: Output port object creation error.

◆ rte_swx_pipeline_mirroring_config()

__rte_experimental int rte_swx_pipeline_mirroring_config ( struct rte_swx_pipeline *  p,
struct rte_swx_pipeline_mirroring_params params 
)

Packet mirroring configure

Parameters
[in]pPipeline handle.
[in]paramsPacket mirroring parameters.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough memory; -EEXIST: Pipeline was already built successfully.

◆ rte_swx_pipeline_extern_type_register()

__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 
)

Pipeline extern type register

Parameters
[in]pPipeline handle.
[in]nameExtern type name.
[in]mailbox_struct_type_nameName of existing struct type used to define the mailbox size and layout for the extern objects that are instances of this type. Each extern object gets its own mailbox, which is used to pass the input arguments to the member functions and retrieve the output results.
[in]constructorFunction used to create the extern objects that are instances of this type.
[in]destructorFunction used to free the extern objects that are instances of this type.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Extern type with this name already exists.

◆ rte_swx_pipeline_extern_type_member_func_register()

__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 
)

Pipeline extern type member function register

Parameters
[in]pPipeline handle.
[in]extern_type_nameExisting extern type name.
[in]nameName for the new member function to be added to the extern type.
[in]member_funcThe new member function.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Member function with this name already exists for this type; -ENOSPC: Maximum number of member functions reached for this type.

◆ rte_swx_pipeline_extern_object_config()

__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 
)

Pipeline extern object configure

Instantiate a given extern type to create new extern object.

Parameters
[in]pPipeline handle.
[in]extern_type_nameExisting extern type name.
[in]nameName for the new object instantiating the extern type.
[in]argsExtern object constructor arguments.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Extern object with this name already exists; -ENODEV: Extern object constructor error.

◆ rte_swx_pipeline_extern_func_register()

__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 
)

Pipeline extern function register

Parameters
[in]pPipeline handle.
[in]nameExtern function name.
[in]mailbox_struct_type_nameName of existing struct type used to define the mailbox size and layout for this extern function. The mailbox is used to pass the input arguments to the extern function and retrieve the output results.
[in]funcThe extern function.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Extern function with this name already exists.

◆ rte_swx_pipeline_hash_func_register()

__rte_experimental int rte_swx_pipeline_hash_func_register ( struct rte_swx_pipeline *  p,
const char *  name,
rte_swx_hash_func_t  func 
)

Pipeline hash function register

Parameters
[in]pPipeline handle.
[in]nameHash function name.
[in]funcHash function.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Hash function with this name already exists.

◆ rte_swx_pipeline_struct_type_register()

__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 
)

Pipeline struct type register

Structs are used extensively in many part of the pipeline to define the size and layout of a specific memory piece such as: headers, meta-data, action data stored in a table entry, mailboxes for extern objects and functions. Similar to C language structs, they are a well defined sequence of fields, with each field having a unique name and a constant size.

In order to use structs to express variable size packet headers such as IPv4 with options, it is allowed for the last field of the struct type to have a variable size between 0 and n_bits bits, with the actual size of this field determined at run-time for each packet. This struct feature is restricted to just a few selected instructions that deal with packet headers, so a typical struct generally has a constant size that is fully known when its struct type is registered.

Parameters
[in]pPipeline handle.
[in]nameStruct type name.
[in]fieldsThe sequence of struct fields.
[in]n_fieldsThe number of struct fields.
[in]last_field_has_variable_sizeIf non-zero (true), then the last field has a variable size between 0 and n_bits bits, with its actual size determined at run-time for each packet. If zero (false), then the last field has a constant size of n_bits bits.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Struct type with this name already exists.

◆ rte_swx_pipeline_packet_header_register()

__rte_experimental int rte_swx_pipeline_packet_header_register ( struct rte_swx_pipeline *  p,
const char *  name,
const char *  struct_type_name 
)

Pipeline packet header register

Parameters
[in]pPipeline handle.
[in]nameHeader name.
[in]struct_type_nameThe struct type instantiated by this packet header.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Header with this name already exists; -ENOSPC: Maximum number of headers reached for the pipeline.

◆ rte_swx_pipeline_packet_metadata_register()

__rte_experimental int rte_swx_pipeline_packet_metadata_register ( struct rte_swx_pipeline *  p,
const char *  struct_type_name 
)

Pipeline packet meta-data register

Parameters
[in]pPipeline handle.
[in]struct_type_nameThe struct type instantiated by the packet meta-data.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_pipeline_action_config()

__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 
)

Instruction operands:

+-----+---------------------------+------------------+-----+-----+
|     | Description               | Format           | DST | SRC |
+-----+---------------------------+------------------+-----+-----+
| hdr | Header                    | h.header         |     |     |
+-----+---------------------------+------------------+-----+-----+
| act | Action                    | ACTION           |     |     |
+-----+---------------------------+------------------+-----+-----+
| tbl | Table                     | TABLE            |     |     |
+-----+---------------------------+------------------+-----+-----+
| H   | Header field              | h.header.field   | YES | YES |
+-----+---------------------------+------------------+-----+-----+
| M   | Meta-data field           | m.field          | YES | YES |
+-----+---------------------------+------------------+-----+-----+
| E   | Extern obj mailbox field  | e.ext_obj.field  | YES | YES |
+-----+---------------------------+------------------+-----+-----+
| F   | Extern func mailbox field | f.ext_func.field | YES | YES |
+-----+---------------------------+------------------+-----+-----+
| T   | Table action data field   | t.header.field   | NO  | YES |
+-----+---------------------------+------------------+-----+-----+
| I   | Immediate value (64-bit)  | h.header.field   | NO  | YES |
+-----+---------------------------+------------------+-----+-----+

Instruction set:

+------------+----------------------+-------------------+------+--------+
| Instr.     | Instruction          | Instruction       | 1st  | 2nd    |
| Name       | Description          | Format            | opnd.| opnd.  |
+------------+----------------------+-------------------+------+--------+
| rx         | Receive one pkt      | rx m.port_in      | M    |        |
+------------+----------------------+-------------------+------+--------+
| tx         | Transmit one pkt     | tx m.port_out     | M    |        |
+------------+----------------------+-------------------+------+--------+
| extract    | Extract one hdr      | extract h.hdr     | hdr  |        |
+------------+----------------------+-------------------+------+--------+
| emit       | Emit one hdr         | emit h.hdr        | hdr  |        |
+------------+----------------------+-------------------+------+--------+
| validate   | Validate one hdr     | validate h.hdr    | hdr  |        |
+------------+----------------------+-------------------+------+--------+
| invalidate | Invalidate one hdr   | invalidate h.hdr  | hdr  |        |
+------------+----------------------+-------------------+------+--------+
| mov        | dst = src            | mov dst src       | HMEF | HMEFTI |
+------------+----------------------+-------------------+------+--------+
| add        | dst += src           | add dst src       | HMEF | HMEFTI |
+------------+----------------------+-------------------+------+--------+
| sub        | dst -= src           | add dst src       | HMEF | HMEFTI |
+------------+----------------------+-------------------+------+--------+
| ckadd      | Checksum add: dst =  | add dst src       | HMEF | HMEFTI |
|            | dst '+ src[0:1] '+   |                   |      | or hdr |
|            | src[2:3] '+ ...      |                   |      |        |
+------------+----------------------+-------------------+------+--------+
| cksub      | Checksum subtract:   | add dst src       | HMEF | HMEFTI |
|            | dst = dst '- src     |                   |      |        |
+------------+----------------------+-------------------+------+--------+
| and        | dst &= src           | and dst src       | HMEF | HMEFTI |
+------------+----------------------+-------------------+------+--------+
| or         | dst |= src           | or  dst src       | HMEF | HMEFTI |
+------------+----------------------+-------------------+------+--------+
| xor        | dst ^= src           | xor dst src       | HMEF | HMEFTI |
+------------+----------------------+-------------------+------+--------+
| shl        | dst <<= src          | shl dst src       | HMEF | HMEFTI |
+------------+----------------------+-------------------+------+--------+
| shr        | dst >>= src          | shr dst src       | HMEF | HMEFTI |
+------------+----------------------+-------------------+------+--------+
| table      | Table lookup         | table TABLE       | tbl  |        |
+------------+----------------------+-------------------+------+--------+
| extern     | Ext obj member func  | extern e.obj.mfunc| ext  |        |
|            | call or ext func call| extern f.func     |      |        |
+------------+----------------------+-------------------+------+--------+
| jmp        | Unconditional jump   | jmp LABEL         |      |        |
+------------+----------------------+-------------------+------+--------+
| jmpv       | Jump if hdr is valid | jmpv LABEL h.hdr  | hdr  |        |
+------------+----------------------+-------------------+------+--------+
| jmpnv      | Jump if hdr is inval | jmpnv LABEL h.hdr | hdr  |        |
+------------+----------------------+-------------------+------+--------+
| jmph       | Jump if tbl lkp hit  | jmph LABEL        |      |        |
+------------+----------------------+-------------------+------+--------+
| jmpnh      | Jump if tbl lkp miss | jmpnh LABEL       |      |        |
+------------+----------------------+-------------------+------+--------+
| jmpa       | Jump if action run   | jmpa LABEL ACTION | act  |        |
+------------+----------------------+-------------------+------+--------+
| jmpna      | Jump if act not run  | jmpna LABEL ACTION| act  |        |
+------------+----------------------+-------------------+------+--------+
| jmpeq      | Jump if (a == b)     | jmpeq LABEL a b   | HMEFT| HMEFTI |
+------------+----------------------+-------------------+------+--------+
| jmpneq     | Jump if (a != b)     | jmpneq LABEL a b  | HMEFT| HMEFTI |
+------------+----------------------+-------------------+------+--------+
| jmplt      | Jump if (a < b)      | jmplt LABEL a b   | HMEFT| HMEFTI |
+------------+----------------------+-------------------+------+--------+
| jmpgt      | Jump if (a > b)      | jmpgt LABEL a b   | HMEFT| HMEFTI |
+------------+----------------------+-------------------+------+--------+
| return     | Return from action   | return            |      |        |
+------------+----------------------+-------------------+------+--------+

At initialization time, the pipeline and action instructions (including the symbolic name operands) are translated to internal data structures that are used at run-time. Pipeline action configure

Parameters
[in]pPipeline handle.
[in]nameAction name.
[in]args_struct_type_nameThe struct type instantiated by the action data. The action data represent the action arguments that are stored in the table entry together with the action ID. Set to NULL when the action does not have any arguments.
[in]instructionsAction instructions.
[in]n_instructionsNumber of action instructions.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Action with this name already exists.

◆ rte_swx_pipeline_table_type_register()

__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 
)

Pipeline table type register

Parameters
[in]pPipeline handle.
[in]nameTable type name.
[in]match_typeMatch type implemented by the new table type.
[in]opsTable type operations.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Table type with this name already exists.

◆ rte_swx_pipeline_table_config()

__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 
)

Pipeline table configure

Parameters
[out]pPipeline handle.
[in]nameTable name.
[in]paramsTable parameters.
[in]recommended_table_type_nameRecommended table type. Typically set to NULL. Useful as guidance when there are multiple table types registered for the match type of the table, as determined from the table match fields specification. Silently ignored if the recommended table type does not exist or it serves a different match type.
[in]argsTable creation arguments.
[in]sizeGuideline on maximum number of table entries.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Table with this name already exists; -ENODEV: Table creation error.

◆ rte_swx_pipeline_selector_config()

__rte_experimental int rte_swx_pipeline_selector_config ( struct rte_swx_pipeline *  p,
const char *  name,
struct rte_swx_pipeline_selector_params params 
)

Pipeline selector table configure

Parameters
[out]pPipeline handle.
[in]nameSelector table name.
[in]paramsSelector table parameters.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Selector table with this name already exists; -ENODEV: Selector table creation error.

◆ rte_swx_pipeline_learner_config()

__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 
)

Pipeline learner table configure

Parameters
[out]pPipeline handle.
[in]nameLearner table name.
[in]paramsLearner table parameters.
[in]sizeThe maximum number of table entries. Must be non-zero.
[in]timeoutArray of possible table entry timeouts in seconds. Must be non-NULL.
[in]n_timeoutsNumber of elements in the timeout array.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Learner table with this name already exists; -ENODEV: Learner table creation error.

◆ rte_swx_pipeline_regarray_config()

__rte_experimental int rte_swx_pipeline_regarray_config ( struct rte_swx_pipeline *  p,
const char *  name,
uint32_t  size,
uint64_t  init_val 
)

Pipeline register array configure

Parameters
[in]pPipeline handle.
[in]nameRegister array name.
[in]sizeNumber of registers in the array. Each register is 64-bit in size.
[in]init_valInitial value for every register in the array. The recommended value is 0.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Register array with this name already exists.

◆ rte_swx_pipeline_metarray_config()

__rte_experimental int rte_swx_pipeline_metarray_config ( struct rte_swx_pipeline *  p,
const char *  name,
uint32_t  size 
)

Pipeline meter array configure

Parameters
[in]pPipeline handle.
[in]nameMeter array name.
[in]sizeNumber of meters in the array. Each meter in the array implements the Two Rate Three Color Marker (trTCM) algorithm, as specified by RFC 2698.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Meter array with this name already exists.

◆ rte_swx_pipeline_instructions_config()

__rte_experimental int rte_swx_pipeline_instructions_config ( struct rte_swx_pipeline *  p,
const char **  instructions,
uint32_t  n_instructions 
)

Pipeline instructions configure

Parameters
[in]pPipeline handle.
[in]instructionsPipeline instructions.
[in]n_instructionsNumber of pipeline instructions.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory.

◆ rte_swx_pipeline_build()

__rte_experimental int rte_swx_pipeline_build ( struct rte_swx_pipeline *  p)

Pipeline build

Once called, the pipeline build operation marks the end of pipeline configuration. At this point, all the internal data structures needed to run the pipeline are built.

Parameters
[in]pPipeline handle.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Pipeline was already built successfully.

◆ rte_swx_pipeline_codegen()

__rte_experimental int rte_swx_pipeline_codegen ( FILE *  spec_file,
FILE *  code_file,
uint32_t *  err_line,
const char **  err_msg 
)

Pipeline C code generate based on input specification file

Parameters
[in]spec_filePipeline specification file (.spec) provided as input.
[in]code_filePipeline C language file (.c) to be generated.
[out]err_lineIn case of error and non-NULL, the line number within the spec file where the error occurred. The first line number in the file is 1.
[out]err_msgIn case of error and non-NULL, the error message.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Resource with the same name already exists.
Examples
examples/pipeline/cli.c.

◆ rte_swx_pipeline_build_from_lib()

__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 
)

Pipeline build from shared object library

The shared object library must be built from the C language source code file previously generated by the rte_swx_pipeline_codegen() API function.

The pipeline I/O specification file defines the I/O ports of the pipeline.

Parameters
[out]pPipeline handle. Must point to valid memory. Contains valid pipeline handle when the function returns successfully.
[in]namePipeline unique name.
[in]lib_file_nameShared object library file name.
[in]iospec_filePipeline I/O specification file.
[in]numa_nodeNon-Uniform Memory Access (NUMA) node.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Pipeline with this name already exists; -ENODEV: Extern object or table creation error.
Examples
examples/pipeline/cli.c.

◆ rte_swx_pipeline_run()

__rte_experimental void rte_swx_pipeline_run ( struct rte_swx_pipeline *  p,
uint32_t  n_instructions 
)

Pipeline run

Parameters
[in]pPipeline handle.
[in]n_instructionsNumber of instructions to execute.
Examples
examples/pipeline/thread.c.

◆ rte_swx_pipeline_flush()

__rte_experimental void rte_swx_pipeline_flush ( struct rte_swx_pipeline *  p)

Pipeline flush

Flush all output ports of the pipeline.

Parameters
[in]pPipeline handle. If p is NULL, no operation is performed.

◆ rte_swx_pipeline_free()

__rte_experimental void rte_swx_pipeline_free ( struct rte_swx_pipeline *  p)

Pipeline free

Parameters
[in]pPipeline handle.
Examples
examples/pipeline/cli.c.