pipeline: add support for action annotations
PATCH 1/1 pipeline: add support for action annotations
Enable restricting the scope of an action to regular table entries or to the table default entry in order to support the P4 language tableonly or defaultonly annotations.
--- lib/pipeline/rte_swx_ctl.c | 6 ++ lib/pipeline/rte_swx_ctl.h | 6 ++ lib/pipeline/rte_swx_pipeline.c | 105 +++++++++++++++++++++++++------ lib/pipeline/rte_swx_pipeline.h | 28 +++++++++ lib/pipeline/rte_swx_pipeline_internal.h | 4 ++ lib/pipeline/rte_swx_pipeline_spec.c | 101 +++++++++++++++++++++++------ 6 files changed, 212 insertions(+), 38 deletions(-)
lib/pipeline/rte_swx_ctl.c +6 -0
@@ -1446,6 +1446,8 @@ struct rte_swx_ctl_pipeline *CHECK (entry,EINVAL );CHECK (!table_entry_check (ctl, table_id, entry,1 ,1 ),EINVAL ); +CHECK (table->actions[entry->action_id].action_is_for_table_entries,EINVAL ); + new_entry =table_entry_duplicate (ctl, table_id, entry,1 ,1 );CHECK (new_entry,ENOMEM );
@@ -1651,6 +1653,8 @@ struct rte_swx_ctl_pipeline *CHECK (entry,EINVAL );CHECK (!table_entry_check (ctl, table_id, entry,0 ,1 ),EINVAL ); +CHECK (table->actions[entry->action_id].action_is_for_default_entry,EINVAL ); + new_entry =table_entry_duplicate (ctl, table_id, entry,0 ,1 );CHECK (new_entry,ENOMEM );
@@ -2378,6 +2382,8 @@ struct rte_swx_ctl_pipeline *CHECK (entry,EINVAL );CHECK (!learner_default_entry_check (ctl, learner_id, entry),EINVAL ); +CHECK (l->actions[entry->action_id].action_is_for_default_entry,EINVAL ); + new_entry =learner_default_entry_duplicate (ctl, learner_id, entry);CHECK (new_entry,ENOMEM );
lib/pipeline/rte_swx_ctl.h +6 -0
@@ -301,6 +301,12 @@ struct rte_swx_ctl_table_match_field_info {struct rte_swx_ctl_table_action_info {/** Action ID. */ uint32_t action_id; + +/** When non-zero (true), the action can be assigned to regular table entries. */ +int action_is_for_table_entries; + +/** When non-zero (true), the action can be assigned to the table default entry. */ +int action_is_for_default_entry; };/**
lib/pipeline/rte_swx_pipeline.c +86 -19
209 lines not on this page · raw message
lib/pipeline/rte_swx_pipeline.h +28 -0
@@ -567,6 +567,20 @@ struct rte_swx_pipeline_table_params {/** The set of actions for the current table. */ const char **action_names; +/** Array of *n_actions* flags. For each action, the associated flag +* indicates whether the action can be assigned to regular table entries +* (when non-zero, i.e. true) or not (when zero, i.e. false). When set +* to NULL, it defaults to true for all actions. +*/ +int *action_is_for_table_entries; + +/** Array of *n_actions* flags. For each action, the associated flag +* indicates whether the action can be assigned to the default table +* entry (when non-zero, i.e. true) or not (when zero, i.e. false). +* When set to NULL, it defaults to true for all actions. +*/ +int *action_is_for_default_entry; +/** The number of actions for the current table. Must be at least one. */ uint32_t n_actions;
@@ -692,6 +706,20 @@ struct rte_swx_pipeline_learner_params {/** The set of actions for the current table. */ const char **action_names; +/** Array of *n_actions* flags. For each action, the associated flag +* indicates whether the action can be assigned to regular table entries +* (when non-zero, i.e. true) or not (when zero, i.e. false). When set +* to NULL, it defaults to true for all actions. +*/ +int *action_is_for_table_entries; + +/** Array of *n_actions* flags. For each action, the associated flag +* indicates whether the action can be assigned to the default table +* entry (when non-zero, i.e. true) or not (when zero, i.e. false). +* When set to NULL, it defaults to true for all actions. +*/ +int *action_is_for_default_entry; +/** The number of actions for the current table. Must be at least one. */ uint32_t n_actions;
lib/pipeline/rte_swx_pipeline_internal.h +4 -0
@@ -746,6 +746,8 @@ struct table {uint32_t n_actions;int default_action_is_const;uint32_t action_data_size_max; +int *action_is_for_table_entries; +int *action_is_for_default_entry;uint32_t size;uint32_t id;
@@ -815,6 +817,8 @@ struct learner {uint32_t n_actions;int default_action_is_const;uint32_t action_data_size_max; +int *action_is_for_table_entries; +int *action_is_for_default_entry;uint32_t size;uint32_t timeout;
lib/pipeline/rte_swx_pipeline_spec.c +82 -19
182 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 1/1 pipeline: add support for action annotations
Enable restricting the scope of an action to regular table entries or to the table default entry in order to support the P4 language tableonly or defaultonly annotations.
--- lib/pipeline/rte_swx_ctl.c | 6 ++ lib/pipeline/rte_swx_ctl.h | 6 ++ lib/pipeline/rte_swx_pipeline.c | 108 +++++++++++++++++++++++++------ lib/pipeline/rte_swx_pipeline.h | 28 ++++++++ lib/pipeline/rte_swx_pipeline_internal.h | 4 ++ lib/pipeline/rte_swx_pipeline_spec.c | 101 +++++++++++++++++++++++------ 6 files changed, 215 insertions(+), 38 deletions(-)
lib/pipeline/rte_swx_ctl.c +6 -0
@@ -1446,6 +1446,8 @@ struct rte_swx_ctl_pipeline *CHECK (entry,EINVAL );CHECK (!table_entry_check (ctl, table_id, entry,1 ,1 ),EINVAL ); +CHECK (table->actions[entry->action_id].action_is_for_table_entries,EINVAL ); + new_entry =table_entry_duplicate (ctl, table_id, entry,1 ,1 );CHECK (new_entry,ENOMEM );
@@ -1651,6 +1653,8 @@ struct rte_swx_ctl_pipeline *CHECK (entry,EINVAL );CHECK (!table_entry_check (ctl, table_id, entry,0 ,1 ),EINVAL ); +CHECK (table->actions[entry->action_id].action_is_for_default_entry,EINVAL ); + new_entry =table_entry_duplicate (ctl, table_id, entry,0 ,1 );CHECK (new_entry,ENOMEM );
@@ -2378,6 +2382,8 @@ struct rte_swx_ctl_pipeline *CHECK (entry,EINVAL );CHECK (!learner_default_entry_check (ctl, learner_id, entry),EINVAL ); +CHECK (l->actions[entry->action_id].action_is_for_default_entry,EINVAL ); + new_entry =learner_default_entry_duplicate (ctl, learner_id, entry);CHECK (new_entry,ENOMEM );
lib/pipeline/rte_swx_ctl.h +6 -0
@@ -301,6 +301,12 @@ struct rte_swx_ctl_table_match_field_info {struct rte_swx_ctl_table_action_info {/** Action ID. */ uint32_t action_id; + +/** When non-zero (true), the action can be assigned to regular table entries. */ +int action_is_for_table_entries; + +/** When non-zero (true), the action can be assigned to the table default entry. */ +int action_is_for_default_entry; };/**
lib/pipeline/rte_swx_pipeline.c +89 -19
212 lines not on this page · raw message
lib/pipeline/rte_swx_pipeline.h +28 -0
@@ -567,6 +567,20 @@ struct rte_swx_pipeline_table_params {/** The set of actions for the current table. */ const char **action_names; +/** Array of *n_actions* flags. For each action, the associated flag +* indicates whether the action can be assigned to regular table entries +* (when non-zero, i.e. true) or not (when zero, i.e. false). When set +* to NULL, it defaults to true for all actions. +*/ +int *action_is_for_table_entries; + +/** Array of *n_actions* flags. For each action, the associated flag +* indicates whether the action can be assigned to the default table +* entry (when non-zero, i.e. true) or not (when zero, i.e. false). +* When set to NULL, it defaults to true for all actions. +*/ +int *action_is_for_default_entry; +/** The number of actions for the current table. Must be at least one. */ uint32_t n_actions;
@@ -692,6 +706,20 @@ struct rte_swx_pipeline_learner_params {/** The set of actions for the current table. */ const char **action_names; +/** Array of *n_actions* flags. For each action, the associated flag +* indicates whether the action can be assigned to regular table entries +* (when non-zero, i.e. true) or not (when zero, i.e. false). When set +* to NULL, it defaults to true for all actions. +*/ +int *action_is_for_table_entries; + +/** Array of *n_actions* flags. For each action, the associated flag +* indicates whether the action can be assigned to the default table +* entry (when non-zero, i.e. true) or not (when zero, i.e. false). +* When set to NULL, it defaults to true for all actions. +*/ +int *action_is_for_default_entry; +/** The number of actions for the current table. Must be at least one. */ uint32_t n_actions;
lib/pipeline/rte_swx_pipeline_internal.h +4 -0
@@ -746,6 +746,8 @@ struct table {uint32_t n_actions;int default_action_is_const;uint32_t action_data_size_max; +int *action_is_for_table_entries; +int *action_is_for_default_entry;uint32_t size;uint32_t id;
@@ -815,6 +817,8 @@ struct learner {uint32_t n_actions;int default_action_is_const;uint32_t action_data_size_max; +int *action_is_for_table_entries; +int *action_is_for_default_entry;uint32_t size;uint32_t timeout;
lib/pipeline/rte_swx_pipeline_spec.c +82 -19
182 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Thomas Monjalon
Applied18/10/2021 03:22, Yogesh Jangra:
Quoted 6 lines
Enable restricting the scope of an action to regular table entries or to the table default entry in order to support the P4 language tableonly or defaultonly annotations.
Signed-off-by Yogesh Jangra <[email protected]>
Applied, thanks.