DPDK  20.11.10
Data Structures | Macros | Functions
rte_swx_ctl.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <rte_compat.h>
#include "rte_swx_port.h"
#include "rte_swx_table.h"

Go to the source code of this file.

Data Structures

struct  rte_swx_ctl_pipeline_info
 
struct  rte_swx_ctl_action_info
 
struct  rte_swx_ctl_action_arg_info
 
struct  rte_swx_ctl_table_info
 
struct  rte_swx_ctl_table_match_field_info
 
struct  rte_swx_ctl_table_action_info
 
struct  rte_swx_table_state
 

Macros

#define RTE_SWX_CTL_NAME_SIZE   64
 

Functions

__rte_experimental int rte_swx_ctl_pipeline_info_get (struct rte_swx_pipeline *p, struct rte_swx_ctl_pipeline_info *pipeline)
 
__rte_experimental int rte_swx_ctl_pipeline_numa_node_get (struct rte_swx_pipeline *p, int *numa_node)
 
__rte_experimental int rte_swx_ctl_pipeline_port_in_stats_read (struct rte_swx_pipeline *p, uint32_t port_id, struct rte_swx_port_in_stats *stats)
 
__rte_experimental int rte_swx_ctl_pipeline_port_out_stats_read (struct rte_swx_pipeline *p, uint32_t port_id, struct rte_swx_port_out_stats *stats)
 
__rte_experimental int rte_swx_ctl_action_info_get (struct rte_swx_pipeline *p, uint32_t action_id, struct rte_swx_ctl_action_info *action)
 
__rte_experimental int rte_swx_ctl_action_arg_info_get (struct rte_swx_pipeline *p, uint32_t action_id, uint32_t action_arg_id, struct rte_swx_ctl_action_arg_info *action_arg)
 
__rte_experimental int rte_swx_ctl_table_info_get (struct rte_swx_pipeline *p, uint32_t table_id, struct rte_swx_ctl_table_info *table)
 
__rte_experimental int rte_swx_ctl_table_match_field_info_get (struct rte_swx_pipeline *p, uint32_t table_id, uint32_t match_field_id, struct rte_swx_ctl_table_match_field_info *match_field)
 
__rte_experimental int rte_swx_ctl_table_action_info_get (struct rte_swx_pipeline *p, uint32_t table_id, uint32_t table_action_id, struct rte_swx_ctl_table_action_info *table_action)
 
__rte_experimental int rte_swx_ctl_table_ops_get (struct rte_swx_pipeline *p, uint32_t table_id, struct rte_swx_table_ops *table_ops, int *is_stub)
 
__rte_experimental int rte_swx_pipeline_table_state_get (struct rte_swx_pipeline *p, struct rte_swx_table_state **table_state)
 
__rte_experimental int rte_swx_pipeline_table_state_set (struct rte_swx_pipeline *p, struct rte_swx_table_state *table_state)
 
__rte_experimental struct rte_swx_ctl_pipeline * rte_swx_ctl_pipeline_create (struct rte_swx_pipeline *p)
 
__rte_experimental int rte_swx_ctl_pipeline_table_entry_add (struct rte_swx_ctl_pipeline *ctl, const char *table_name, struct rte_swx_table_entry *entry)
 
__rte_experimental int rte_swx_ctl_pipeline_table_default_entry_add (struct rte_swx_ctl_pipeline *ctl, const char *table_name, struct rte_swx_table_entry *entry)
 
__rte_experimental int rte_swx_ctl_pipeline_table_entry_delete (struct rte_swx_ctl_pipeline *ctl, const char *table_name, struct rte_swx_table_entry *entry)
 
__rte_experimental int rte_swx_ctl_pipeline_commit (struct rte_swx_ctl_pipeline *ctl, int abort_on_fail)
 
__rte_experimental void rte_swx_ctl_pipeline_abort (struct rte_swx_ctl_pipeline *ctl)
 
__rte_experimental struct rte_swx_table_entryrte_swx_ctl_pipeline_table_entry_read (struct rte_swx_ctl_pipeline *ctl, const char *table_name, const char *string)
 
__rte_experimental int rte_swx_ctl_pipeline_table_fprintf (FILE *f, struct rte_swx_ctl_pipeline *ctl, const char *table_name)
 
__rte_experimental void rte_swx_ctl_pipeline_free (struct rte_swx_ctl_pipeline *ctl)
 

Detailed Description

RTE SWX Pipeline Control

Definition in file rte_swx_ctl.h.

Macro Definition Documentation

◆ RTE_SWX_CTL_NAME_SIZE

#define RTE_SWX_CTL_NAME_SIZE   64

Name size.

Definition at line 29 of file rte_swx_ctl.h.

Function Documentation

◆ rte_swx_ctl_pipeline_info_get()

__rte_experimental int rte_swx_ctl_pipeline_info_get ( struct rte_swx_pipeline *  p,
struct rte_swx_ctl_pipeline_info pipeline 
)

Pipeline info get

Parameters
[in]pPipeline handle.
[out]pipelinePipeline info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_numa_node_get()

__rte_experimental int rte_swx_ctl_pipeline_numa_node_get ( struct rte_swx_pipeline *  p,
int *  numa_node 
)

Pipeline NUMA node get

Parameters
[in]pPipeline handle.
[out]numa_nodePipeline NUMA node.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_pipeline_port_in_stats_read()

__rte_experimental int rte_swx_ctl_pipeline_port_in_stats_read ( struct rte_swx_pipeline *  p,
uint32_t  port_id,
struct rte_swx_port_in_stats stats 
)

Input port statistics counters read

Parameters
[in]pPipeline handle.
[in]port_idPort ID (0 .. n_ports_in - 1).
[out]statsInput port stats.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_port_out_stats_read()

__rte_experimental int rte_swx_ctl_pipeline_port_out_stats_read ( struct rte_swx_pipeline *  p,
uint32_t  port_id,
struct rte_swx_port_out_stats stats 
)

Output port statistics counters read

Parameters
[in]pPipeline handle.
[in]port_idPort ID (0 .. n_ports_out - 1).
[out]statsOutput port stats.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_action_info_get()

__rte_experimental int rte_swx_ctl_action_info_get ( struct rte_swx_pipeline *  p,
uint32_t  action_id,
struct rte_swx_ctl_action_info action 
)

Action info get

Parameters
[in]pPipeline handle.
[in]action_idAction ID (0 .. n_actions - 1).
[out]actionAction info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_action_arg_info_get()

__rte_experimental int rte_swx_ctl_action_arg_info_get ( struct rte_swx_pipeline *  p,
uint32_t  action_id,
uint32_t  action_arg_id,
struct rte_swx_ctl_action_arg_info action_arg 
)

Action argument info get

Parameters
[in]pPipeline handle.
[in]action_idAction ID (0 .. n_actions - 1).
[in]action_arg_idAction ID (0 .. n_args - 1).
[out]action_argAction argument info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_table_info_get()

__rte_experimental int rte_swx_ctl_table_info_get ( struct rte_swx_pipeline *  p,
uint32_t  table_id,
struct rte_swx_ctl_table_info table 
)

Table info get

Parameters
[in]pPipeline handle.
[in]table_idTable ID (0 .. n_tables - 1).
[out]tableTable info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_table_match_field_info_get()

__rte_experimental int rte_swx_ctl_table_match_field_info_get ( struct rte_swx_pipeline *  p,
uint32_t  table_id,
uint32_t  match_field_id,
struct rte_swx_ctl_table_match_field_info match_field 
)

Table match field info get

Parameters
[in]pPipeline handle.
[in]table_idTable ID (0 .. n_tables).
[in]match_field_idMatch field ID (0 .. n_match_fields - 1).
[out]match_fieldTable match field info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_table_action_info_get()

__rte_experimental int rte_swx_ctl_table_action_info_get ( struct rte_swx_pipeline *  p,
uint32_t  table_id,
uint32_t  table_action_id,
struct rte_swx_ctl_table_action_info table_action 
)

Table action info get

Parameters
[in]pPipeline handle.
[in]table_idTable ID (0 .. n_tables).
[in]table_action_idAction index within the set of table actions (0 .. table n_actions - 1). Not to be confused with the action ID, which works at the pipeline level (0 .. pipeline n_actions - 1), which is precisely what this function returns as part of table_action.
[out]table_actionTable action info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_table_ops_get()

__rte_experimental int rte_swx_ctl_table_ops_get ( struct rte_swx_pipeline *  p,
uint32_t  table_id,
struct rte_swx_table_ops table_ops,
int *  is_stub 
)

Table operations get

Parameters
[in]pPipeline handle.
[in]table_idTable ID (0 .. n_tables).
[out]table_opsTable operations. Only valid when function returns success and is_stub is zero (false).
[out]is_stubA stub table is a table with no match fields. No "regular" table entries (i.e. entries other than the default entry) can be added to such a table, therefore the lookup operation always results in lookup miss. Non-zero (true) when the current table is a stub table, zero (false) otherwise.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_pipeline_table_state_get()

__rte_experimental int rte_swx_pipeline_table_state_get ( struct rte_swx_pipeline *  p,
struct rte_swx_table_state **  table_state 
)

Pipeline table state get

Parameters
[in]pPipeline handle.
[out]table_stateAfter successful execution, the table_state contains the pointer to the current pipeline table state, which is an array of n_tables elements, with array element i containing the state of the i-th pipeline table. The pipeline continues to own all the data structures directly or indirectly referenced by the table_state until the subsequent successful invocation of function rte_swx_pipeline_table_state_set.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_pipeline_table_state_set()

__rte_experimental int rte_swx_pipeline_table_state_set ( struct rte_swx_pipeline *  p,
struct rte_swx_table_state table_state 
)

Pipeline table state set

Parameters
[in]pPipeline handle.
[out]table_stateAfter successful execution, the pipeline table state is updated to this table_state. The ownership of all the data structures directly or indirectly referenced by this table_state is passed from the caller to the pipeline.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_pipeline_create()

__rte_experimental struct rte_swx_ctl_pipeline* rte_swx_ctl_pipeline_create ( struct rte_swx_pipeline *  p)

Pipeline control create

Parameters
[in]pPipeline handle.
Returns
Pipeline control handle, on success, or NULL, on error.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_table_entry_add()

__rte_experimental int rte_swx_ctl_pipeline_table_entry_add ( struct rte_swx_ctl_pipeline *  ctl,
const char *  table_name,
struct rte_swx_table_entry entry 
)

Pipeline table entry add

Schedule entry for addition to table or update as part of the next commit operation.

Parameters
[in]ctlPipeline control handle.
[in]table_nameTable name.
[in]entryEntry to be added to the table.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_table_default_entry_add()

__rte_experimental int rte_swx_ctl_pipeline_table_default_entry_add ( struct rte_swx_ctl_pipeline *  ctl,
const char *  table_name,
struct rte_swx_table_entry entry 
)

Pipeline table default entry add

Schedule table default entry update as part of the next commit operation.

Parameters
[in]ctlPipeline control handle.
[in]table_nameTable name.
[in]entryThe new table default entry. The key and key_mask entry fields are ignored.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_table_entry_delete()

__rte_experimental int rte_swx_ctl_pipeline_table_entry_delete ( struct rte_swx_ctl_pipeline *  ctl,
const char *  table_name,
struct rte_swx_table_entry entry 
)

Pipeline table entry delete

Schedule entry for deletion from table as part of the next commit operation. Request is silently discarded if no such entry exists.

Parameters
[in]ctlPipeline control handle.
[in]table_nameTable name.
[in]entryEntry to be deleted from the table. The action_id and action_data entry fields are ignored.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_commit()

__rte_experimental int rte_swx_ctl_pipeline_commit ( struct rte_swx_ctl_pipeline *  ctl,
int  abort_on_fail 
)

Pipeline commit

Perform all the scheduled table work.

Parameters
[in]ctlPipeline control handle.
[in]abort_on_failWhen non-zero (false), all the scheduled work is discarded after a failed commit. Otherwise, the scheduled work is still kept pending for the next commit.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_abort()

__rte_experimental void rte_swx_ctl_pipeline_abort ( struct rte_swx_ctl_pipeline *  ctl)

Pipeline abort

Discard all the scheduled table work.

Parameters
[in]ctlPipeline control handle.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_table_entry_read()

__rte_experimental struct rte_swx_table_entry* rte_swx_ctl_pipeline_table_entry_read ( struct rte_swx_ctl_pipeline *  ctl,
const char *  table_name,
const char *  string 
)

Pipeline table entry read

Read table entry from string.

Parameters
[in]ctlPipeline control handle.
[in]table_nameTable name.
[in]stringString containing the table entry.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_table_fprintf()

__rte_experimental int rte_swx_ctl_pipeline_table_fprintf ( FILE *  f,
struct rte_swx_ctl_pipeline *  ctl,
const char *  table_name 
)

Pipeline table print to file

Print all the table entries to file.

Parameters
[in]fOutput file.
[in]ctlPipeline control handle.
[in]table_nameTable name.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_free()

__rte_experimental void rte_swx_ctl_pipeline_free ( struct rte_swx_ctl_pipeline *  ctl)

Pipeline control free

Parameters
[in]ctlPipeline control handle.