Skip to content

Commit

Permalink
pipeline: add SWX pipeline specification file
Browse files Browse the repository at this point in the history
Add support for building the SWX pipeline based on specification file
with syntax aligned to the P4 language. The specification file may be
generated by the P4C compiler in the future.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  • Loading branch information
cristian-dumitrescu authored and david-marchand committed Oct 1, 2020
1 parent b32c0a2 commit 3ca60ce
Show file tree
Hide file tree
Showing 4 changed files with 1,467 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/librte_pipeline/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sources = files('rte_pipeline.c',
'rte_port_in_action.c',
'rte_table_action.c',
'rte_swx_pipeline.c',
'rte_swx_pipeline_spec.c',
'rte_swx_ctl.c',)
headers = files('rte_pipeline.h',
'rte_port_in_action.h',
Expand Down
1 change: 1 addition & 0 deletions lib/librte_pipeline/rte_pipeline_version.map
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ EXPERIMENTAL {
rte_swx_ctl_table_ops_get;
rte_swx_pipeline_action_config;
rte_swx_pipeline_build;
rte_swx_pipeline_build_from_spec;
rte_swx_pipeline_config;
rte_swx_pipeline_extern_func_register;
rte_swx_pipeline_extern_object_config;
Expand Down
26 changes: 26 additions & 0 deletions lib/librte_pipeline/rte_swx_pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,32 @@ __rte_experimental
int
rte_swx_pipeline_build(struct rte_swx_pipeline *p);

/**
* Pipeline build from specification file
*
* @param[in] p
* Pipeline handle.
* @param[in] spec
* Pipeline specification file.
* @param[out] err_line
* In 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.
* @param[out] err_msg
* In case of error and non-NULL, the error message.
* @return
* 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;
* -ENODEV: Extern object or table creation error.
*/
__rte_experimental
int
rte_swx_pipeline_build_from_spec(struct rte_swx_pipeline *p,
FILE *spec,
uint32_t *err_line,
const char **err_msg);

/**
* Pipeline run
*
Expand Down
Loading

0 comments on commit 3ca60ce

Please sign in to comment.