DPDK  21.11.6
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_meter.h>
#include "rte_swx_port.h"
#include "rte_swx_table.h"
#include "rte_swx_table_selector.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_stats
 
struct  rte_swx_ctl_selector_info
 
struct  rte_swx_pipeline_selector_stats
 
struct  rte_swx_ctl_learner_info
 
struct  rte_swx_learner_stats
 
struct  rte_swx_table_state
 
struct  rte_swx_ctl_regarray_info
 
struct  rte_swx_ctl_metarray_info
 
struct  rte_swx_ctl_meter_stats
 

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_ctl_pipeline_table_stats_read (struct rte_swx_pipeline *p, const char *table_name, struct rte_swx_table_stats *stats)
 
__rte_experimental int rte_swx_ctl_selector_info_get (struct rte_swx_pipeline *p, uint32_t selector_id, struct rte_swx_ctl_selector_info *selector)
 
__rte_experimental int rte_swx_ctl_selector_group_id_field_info_get (struct rte_swx_pipeline *p, uint32_t selector_id, struct rte_swx_ctl_table_match_field_info *field)
 
__rte_experimental int rte_swx_ctl_selector_field_info_get (struct rte_swx_pipeline *p, uint32_t selector_id, uint32_t selector_field_id, struct rte_swx_ctl_table_match_field_info *field)
 
__rte_experimental int rte_swx_ctl_selector_member_id_field_info_get (struct rte_swx_pipeline *p, uint32_t selector_id, struct rte_swx_ctl_table_match_field_info *field)
 
__rte_experimental int rte_swx_ctl_pipeline_selector_stats_read (struct rte_swx_pipeline *p, const char *selector_name, struct rte_swx_pipeline_selector_stats *stats)
 
__rte_experimental int rte_swx_ctl_learner_info_get (struct rte_swx_pipeline *p, uint32_t learner_id, struct rte_swx_ctl_learner_info *learner)
 
__rte_experimental int rte_swx_ctl_learner_match_field_info_get (struct rte_swx_pipeline *p, uint32_t learner_id, uint32_t match_field_id, struct rte_swx_ctl_table_match_field_info *match_field)
 
__rte_experimental int rte_swx_ctl_learner_action_info_get (struct rte_swx_pipeline *p, uint32_t learner_id, uint32_t learner_action_id, struct rte_swx_ctl_table_action_info *learner_action)
 
__rte_experimental int rte_swx_ctl_pipeline_learner_stats_read (struct rte_swx_pipeline *p, const char *learner_name, struct rte_swx_learner_stats *stats)
 
__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_selector_group_add (struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t *group_id)
 
__rte_experimental int rte_swx_ctl_pipeline_selector_group_delete (struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t group_id)
 
__rte_experimental int rte_swx_ctl_pipeline_selector_group_member_add (struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t group_id, uint32_t member_id, uint32_t member_weight)
 
__rte_experimental int rte_swx_ctl_pipeline_selector_group_member_delete (struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t group_id, uint32_t member_id)
 
__rte_experimental int rte_swx_ctl_pipeline_learner_default_entry_add (struct rte_swx_ctl_pipeline *ctl, const char *learner_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, int *is_blank_or_comment)
 
__rte_experimental struct rte_swx_table_entryrte_swx_ctl_pipeline_learner_default_entry_read (struct rte_swx_ctl_pipeline *ctl, const char *learner_name, const char *string, int *is_blank_or_comment)
 
__rte_experimental int rte_swx_ctl_pipeline_table_fprintf (FILE *f, struct rte_swx_ctl_pipeline *ctl, const char *table_name)
 
__rte_experimental int rte_swx_ctl_pipeline_selector_fprintf (FILE *f, struct rte_swx_ctl_pipeline *ctl, const char *selector_name)
 
__rte_experimental int rte_swx_ctl_regarray_info_get (struct rte_swx_pipeline *p, uint32_t regarray_id, struct rte_swx_ctl_regarray_info *regarray)
 
__rte_experimental int rte_swx_ctl_pipeline_regarray_read (struct rte_swx_pipeline *p, const char *regarray_name, uint32_t regarray_index, uint64_t *value)
 
__rte_experimental int rte_swx_ctl_pipeline_regarray_write (struct rte_swx_pipeline *p, const char *regarray_name, uint32_t regarray_index, uint64_t value)
 
__rte_experimental int rte_swx_ctl_metarray_info_get (struct rte_swx_pipeline *p, uint32_t metarray_id, struct rte_swx_ctl_metarray_info *metarray)
 
__rte_experimental int rte_swx_ctl_meter_profile_add (struct rte_swx_pipeline *p, const char *name, struct rte_meter_trtcm_params *params)
 
__rte_experimental int rte_swx_ctl_meter_profile_delete (struct rte_swx_pipeline *p, const char *name)
 
__rte_experimental int rte_swx_ctl_meter_reset (struct rte_swx_pipeline *p, const char *metarray_name, uint32_t metarray_index)
 
__rte_experimental int rte_swx_ctl_meter_set (struct rte_swx_pipeline *p, const char *metarray_name, uint32_t metarray_index, const char *profile_name)
 
__rte_experimental int rte_swx_ctl_meter_stats_read (struct rte_swx_pipeline *p, const char *metarray_name, uint32_t metarray_index, struct rte_swx_ctl_meter_stats *stats)
 
__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 31 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.
Examples:
examples/pipeline/cli.c.

◆ 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.
Examples:
examples/pipeline/cli.c.

◆ 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_ctl_pipeline_table_stats_read()

__rte_experimental int rte_swx_ctl_pipeline_table_stats_read ( struct rte_swx_pipeline *  p,
const char *  table_name,
struct rte_swx_table_stats stats 
)

Table statistics counters read

Parameters
[in]pPipeline handle.
[in]table_nameTable name.
[out]statsTable stats. Must point to a pre-allocated structure. The n_pkts_action field also needs to be pre-allocated as array of pipeline n_actions elements. The pipeline actions that are not valid for the current table have their associated n_pkts_action element always set to zero.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_selector_info_get()

__rte_experimental int rte_swx_ctl_selector_info_get ( struct rte_swx_pipeline *  p,
uint32_t  selector_id,
struct rte_swx_ctl_selector_info selector 
)

Selector table info get

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

◆ rte_swx_ctl_selector_group_id_field_info_get()

__rte_experimental int rte_swx_ctl_selector_group_id_field_info_get ( struct rte_swx_pipeline *  p,
uint32_t  selector_id,
struct rte_swx_ctl_table_match_field_info field 
)

Selector table "group ID" field info get

Parameters
[in]pPipeline handle.
[in]selector_idSelector table ID (0 .. n_selectors).
[out]fieldSelector table "group ID" field info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_selector_field_info_get()

__rte_experimental int rte_swx_ctl_selector_field_info_get ( struct rte_swx_pipeline *  p,
uint32_t  selector_id,
uint32_t  selector_field_id,
struct rte_swx_ctl_table_match_field_info field 
)

Sselector table selector field info get

Parameters
[in]pPipeline handle.
[in]selector_idSelector table ID (0 .. n_selectors).
[in]selector_field_idSelector table selector field ID (0 .. n_selector_fields - 1).
[out]fieldSelector table selector field info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_selector_member_id_field_info_get()

__rte_experimental int rte_swx_ctl_selector_member_id_field_info_get ( struct rte_swx_pipeline *  p,
uint32_t  selector_id,
struct rte_swx_ctl_table_match_field_info field 
)

Selector table "member ID" field info get

Parameters
[in]pPipeline handle.
[in]selector_idSelector table ID (0 .. n_selectors).
[out]fieldSelector table "member ID" field info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_pipeline_selector_stats_read()

__rte_experimental int rte_swx_ctl_pipeline_selector_stats_read ( struct rte_swx_pipeline *  p,
const char *  selector_name,
struct rte_swx_pipeline_selector_stats stats 
)

Selector table statistics counters read

Parameters
[in]pPipeline handle.
[in]selector_nameSelector table name.
[out]statsSelector table stats. Must point to a pre-allocated structure.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_learner_info_get()

__rte_experimental int rte_swx_ctl_learner_info_get ( struct rte_swx_pipeline *  p,
uint32_t  learner_id,
struct rte_swx_ctl_learner_info learner 
)

Learner table info get

Parameters
[in]pPipeline handle.
[in]learner_idLearner table ID (0 .. n_learners - 1).
[out]learnerLearner table info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_learner_match_field_info_get()

__rte_experimental int rte_swx_ctl_learner_match_field_info_get ( struct rte_swx_pipeline *  p,
uint32_t  learner_id,
uint32_t  match_field_id,
struct rte_swx_ctl_table_match_field_info match_field 
)

Learner table match field info get

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

◆ rte_swx_ctl_learner_action_info_get()

__rte_experimental int rte_swx_ctl_learner_action_info_get ( struct rte_swx_pipeline *  p,
uint32_t  learner_id,
uint32_t  learner_action_id,
struct rte_swx_ctl_table_action_info learner_action 
)

Learner table action info get

Parameters
[in]pPipeline handle.
[in]learner_idLearner table ID (0 .. n_learners - 1).
[in]learner_action_idAction index within the set of learner table actions (0 .. learner table n_actions - 1). Not to be confused with the pipeline-leve action ID (0 .. pipeline n_actions - 1), which is precisely what this function returns as part of the learner_action.
[out]learner_actionLearner action info.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.

◆ rte_swx_ctl_pipeline_learner_stats_read()

__rte_experimental int rte_swx_ctl_pipeline_learner_stats_read ( struct rte_swx_pipeline *  p,
const char *  learner_name,
struct rte_swx_learner_stats stats 
)

Learner table statistics counters read

Parameters
[in]pPipeline handle.
[in]learner_nameLearner table name.
[out]statsLearner table stats. Must point to a pre-allocated structure. The n_pkts_action field also needs to be pre-allocated as array of pipeline n_actions elements. The pipeline actions that are not valid for the current learner table have their associated n_pkts_action element always set to zero.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ 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_selector_group_add()

__rte_experimental int rte_swx_ctl_pipeline_selector_group_add ( struct rte_swx_ctl_pipeline *  ctl,
const char *  selector_name,
uint32_t *  group_id 
)

Pipeline selector table group add

Add a new group to a selector table. This operation is executed before this function returns and its result is independent of the result of the next commit operation.

Parameters
[in]ctlPipeline control handle.
[in]selector_nameSelector table name.
[out]group_idThe ID of the new group. Only valid when the function call is successful. This group is initially empty, i.e. it does not contain any members.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOSPC: All groups are currently in use, no group available.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_selector_group_delete()

__rte_experimental int rte_swx_ctl_pipeline_selector_group_delete ( struct rte_swx_ctl_pipeline *  ctl,
const char *  selector_name,
uint32_t  group_id 
)

Pipeline selector table group delete

Schedule a group for deletion as part of the next commit operation. The group to be deleted can be empty or non-empty.

Parameters
[in]ctlPipeline control handle.
[in]selector_nameSelector table name.
[in]group_idGroup to be deleted from the selector table.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough memory.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_selector_group_member_add()

__rte_experimental int rte_swx_ctl_pipeline_selector_group_member_add ( struct rte_swx_ctl_pipeline *  ctl,
const char *  selector_name,
uint32_t  group_id,
uint32_t  member_id,
uint32_t  member_weight 
)

Pipeline selector table member add to group

Schedule the operation to add a new member to an existing group as part of the next commit operation. If this member is already in this group, the member weight is updated to the new value. A weight of zero means this member is to be deleted from the group.

Parameters
[in]ctlPipeline control handle.
[in]selector_nameSelector table name.
[in]group_idThe group ID.
[in]member_idThe member to be added to the group.
[in]member_weightMember weight.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough memory; -ENOSPC: The group is full.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_selector_group_member_delete()

__rte_experimental int rte_swx_ctl_pipeline_selector_group_member_delete ( struct rte_swx_ctl_pipeline *  ctl,
const char *  selector_name,
uint32_t  group_id,
uint32_t  member_id 
)

Pipeline selector table member delete from group

Schedule the operation to delete a member from an existing group as part of the next commit operation.

Parameters
[in]ctlPipeline control handle.
[in]selector_nameSelector table name.
[in]group_idThe group ID. Must be valid.
[in]member_idThe member to be added to the group. Must be valid.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_learner_default_entry_add()

__rte_experimental int rte_swx_ctl_pipeline_learner_default_entry_add ( struct rte_swx_ctl_pipeline *  ctl,
const char *  learner_name,
struct rte_swx_table_entry entry 
)

Pipeline learner table default entry add

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

Parameters
[in]ctlPipeline control handle.
[in]learner_nameLearner table 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_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,
int *  is_blank_or_comment 
)

Pipeline table entry read

Read table entry from string.

Parameters
[in]ctlPipeline control handle.
[in]table_nameTable name.
[in]stringString containing the table entry.
[out]is_blank_or_commentOn error, this argument provides an indication of whether string contains an invalid table entry (set to zero) or a blank or comment line that should typically be ignored (set to a non-zero value).
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_learner_default_entry_read()

__rte_experimental struct rte_swx_table_entry* rte_swx_ctl_pipeline_learner_default_entry_read ( struct rte_swx_ctl_pipeline *  ctl,
const char *  learner_name,
const char *  string,
int *  is_blank_or_comment 
)

Pipeline learner table default entry read

Read learner table default entry from string.

Parameters
[in]ctlPipeline control handle.
[in]learner_nameLearner table name.
[in]stringString containing the learner table default entry.
[out]is_blank_or_commentOn error, this argument provides an indication of whether string contains an invalid table entry (set to zero) or a blank or comment line that should typically be ignored (set to a non-zero value).
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_selector_fprintf()

__rte_experimental int rte_swx_ctl_pipeline_selector_fprintf ( FILE *  f,
struct rte_swx_ctl_pipeline *  ctl,
const char *  selector_name 
)

Pipeline selector print to file

Print all the selector entries to file.

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

◆ rte_swx_ctl_regarray_info_get()

__rte_experimental int rte_swx_ctl_regarray_info_get ( struct rte_swx_pipeline *  p,
uint32_t  regarray_id,
struct rte_swx_ctl_regarray_info regarray 
)

Register array info get

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

◆ rte_swx_ctl_pipeline_regarray_read()

__rte_experimental int rte_swx_ctl_pipeline_regarray_read ( struct rte_swx_pipeline *  p,
const char *  regarray_name,
uint32_t  regarray_index,
uint64_t *  value 
)

Register read

Parameters
[in]pPipeline handle.
[in]regarray_nameRegister array name.
[in]regarray_indexRegister index within the array (0 .. size - 1).
[out]valueCurrent register value.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_pipeline_regarray_write()

__rte_experimental int rte_swx_ctl_pipeline_regarray_write ( struct rte_swx_pipeline *  p,
const char *  regarray_name,
uint32_t  regarray_index,
uint64_t  value 
)

Register write

Parameters
[in]pPipeline handle.
[in]regarray_nameRegister array name.
[in]regarray_indexRegister index within the array (0 .. size - 1).
[in]valueValue to be written to the register.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_metarray_info_get()

__rte_experimental int rte_swx_ctl_metarray_info_get ( struct rte_swx_pipeline *  p,
uint32_t  metarray_id,
struct rte_swx_ctl_metarray_info metarray 
)

Meter array info get

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

◆ rte_swx_ctl_meter_profile_add()

__rte_experimental int rte_swx_ctl_meter_profile_add ( struct rte_swx_pipeline *  p,
const char *  name,
struct rte_meter_trtcm_params params 
)

Meter profile add

Parameters
[in]pPipeline handle.
[in]nameMeter profile name.
[in]paramsMeter profile parameters.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -ENOMEM: Not enough space/cannot allocate memory; -EEXIST: Meter profile with this name already exists.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_meter_profile_delete()

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

Meter profile delete

Parameters
[in]pPipeline handle.
[in]nameMeter profile name.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument; -EBUSY: Meter profile is currently in use.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_meter_reset()

__rte_experimental int rte_swx_ctl_meter_reset ( struct rte_swx_pipeline *  p,
const char *  metarray_name,
uint32_t  metarray_index 
)

Meter reset

Reset a meter within a given meter array to use the default profile that causes all the input packets to be colored as green. It is the responsibility of the control plane to make sure this meter is not used by the data plane pipeline before calling this function.

Parameters
[in]pPipeline handle.
[in]metarray_nameMeter array name.
[in]metarray_indexMeter index within the meter array.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_meter_set()

__rte_experimental int rte_swx_ctl_meter_set ( struct rte_swx_pipeline *  p,
const char *  metarray_name,
uint32_t  metarray_index,
const char *  profile_name 
)

Meter set

Set a meter within a given meter array to use a specific profile. It is the responsibility of the control plane to make sure this meter is not used by the data plane pipeline before calling this function.

Parameters
[in]pPipeline handle.
[in]metarray_nameMeter array name.
[in]metarray_indexMeter index within the meter array.
[in]profile_nameExisting meter profile name.
Returns
0 on success or the following error codes otherwise: -EINVAL: Invalid argument.
Examples:
examples/pipeline/cli.c.

◆ rte_swx_ctl_meter_stats_read()

__rte_experimental int rte_swx_ctl_meter_stats_read ( struct rte_swx_pipeline *  p,
const char *  metarray_name,
uint32_t  metarray_index,
struct rte_swx_ctl_meter_stats stats 
)

Meter statistics counters read

Parameters
[in]pPipeline handle.
[in]metarray_nameMeter array name.
[in]metarray_indexMeter index within the meter array.
[out]statsMeter statistics counters.
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.