[V5,03/17] pipeline: add pipeline specification data structure
Checks
Commit Message
Add specification data structure for the entire pipeline.
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Kamalakannan R. <kamalakannan.r@intel.com>
---
lib/pipeline/rte_swx_pipeline_spec.c | 21 ++++++++++++++++++
lib/pipeline/rte_swx_pipeline_spec.h | 32 ++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
@@ -2082,6 +2082,27 @@ apply_block_parse(struct apply_spec *s,
/*
* Pipeline.
*/
+void
+pipeline_spec_free(struct pipeline_spec *s)
+{
+ if (!s)
+ return;
+
+ free(s->extobjs);
+ free(s->structs);
+ free(s->headers);
+ free(s->metadata);
+ free(s->actions);
+ free(s->tables);
+ free(s->selectors);
+ free(s->learners);
+ free(s->regarrays);
+ free(s->metarrays);
+ free(s->apply);
+
+ memset(s, 0, sizeof(struct pipeline_spec));
+}
+
int
rte_swx_pipeline_build_from_spec(struct rte_swx_pipeline *p,
FILE *spec,
@@ -174,3 +174,35 @@ struct apply_spec {
const char **instructions;
uint32_t n_instructions;
};
+
+/*
+ * Pipeline.
+ */
+struct pipeline_spec {
+ struct extobj_spec *extobjs;
+ struct struct_spec *structs;
+ struct header_spec *headers;
+ struct metadata_spec *metadata;
+ struct action_spec *actions;
+ struct table_spec *tables;
+ struct selector_spec *selectors;
+ struct learner_spec *learners;
+ struct regarray_spec *regarrays;
+ struct metarray_spec *metarrays;
+ struct apply_spec *apply;
+
+ uint32_t n_extobjs;
+ uint32_t n_structs;
+ uint32_t n_headers;
+ uint32_t n_metadata;
+ uint32_t n_actions;
+ uint32_t n_tables;
+ uint32_t n_selectors;
+ uint32_t n_learners;
+ uint32_t n_regarrays;
+ uint32_t n_metarrays;
+ uint32_t n_apply;
+};
+
+void
+pipeline_spec_free(struct pipeline_spec *s);