DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Cc: "Kamalakannan R ." <kamalakannan.r@intel.com>
Subject: [PATCH V6 02/17] pipeline: move specification data structures to internal header
Date: Thu, 28 Jul 2022 15:11:32 +0000	[thread overview]
Message-ID: <20220728151147.603265-3-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20220728151147.603265-1-cristian.dumitrescu@intel.com>

Move all the pipeline object specification data structures to an
internal header file.

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 | 126 +------------------
 lib/pipeline/rte_swx_pipeline_spec.h | 176 +++++++++++++++++++++++++++
 2 files changed, 177 insertions(+), 125 deletions(-)
 create mode 100644 lib/pipeline/rte_swx_pipeline_spec.h

diff --git a/lib/pipeline/rte_swx_pipeline_spec.c b/lib/pipeline/rte_swx_pipeline_spec.c
index 904b9eb471..5e07b4f794 100644
--- a/lib/pipeline/rte_swx_pipeline_spec.c
+++ b/lib/pipeline/rte_swx_pipeline_spec.c
@@ -9,7 +9,7 @@
 
 #include <rte_common.h>
 
-#include "rte_swx_pipeline.h"
+#include "rte_swx_pipeline_spec.h"
 
 #ifndef MAX_LINE_LENGTH
 #define MAX_LINE_LENGTH 2048
@@ -34,15 +34,7 @@
 
 /*
  * extobj.
- *
- * extobj OBJ_NAME instanceof OBJ_TYPE [ pragma OBJ_CREATE_ARGS ]
  */
-struct extobj_spec {
-	char *name;
-	char *extern_type_name;
-	char *pragma;
-};
-
 static void
 extobj_spec_free(struct extobj_spec *s)
 {
@@ -104,18 +96,7 @@ extobj_statement_parse(struct extobj_spec *s,
 /*
  * struct.
  *
- * struct STRUCT_TYPE_NAME {
- *	bit<SIZE> | varbit<SIZE> FIELD_NAME
- *	...
- * }
  */
-struct struct_spec {
-	char *name;
-	struct rte_swx_field_params *fields;
-	uint32_t n_fields;
-	int varbit;
-};
-
 static void
 struct_spec_free(struct struct_spec *s)
 {
@@ -293,13 +274,7 @@ struct_block_parse(struct struct_spec *s,
 /*
  * header.
  *
- * header HEADER_NAME instanceof STRUCT_TYPE_NAME
  */
-struct header_spec {
-	char *name;
-	char *struct_type_name;
-};
-
 static void
 header_spec_free(struct header_spec *s)
 {
@@ -351,12 +326,7 @@ header_statement_parse(struct header_spec *s,
 /*
  * metadata.
  *
- * metadata instanceof STRUCT_TYPE_NAME
  */
-struct metadata_spec {
-	char *struct_type_name;
-};
-
 static void
 metadata_spec_free(struct metadata_spec *s)
 {
@@ -400,18 +370,7 @@ metadata_statement_parse(struct metadata_spec *s,
 /*
  * action.
  *
- * action ACTION_NAME args none | instanceof STRUCT_TYPE_NAME {
- *	INSTRUCTION
- *	...
- * }
  */
-struct action_spec {
-	char *name;
-	char *args_struct_type_name;
-	const char **instructions;
-	uint32_t n_instructions;
-};
-
 static void
 action_spec_free(struct action_spec *s)
 {
@@ -540,29 +499,7 @@ action_block_parse(struct action_spec *s,
 /*
  * table.
  *
- * table TABLE_NAME {
- *	key {
- *		MATCH_FIELD_NAME exact | wildcard | lpm
- *		...
- *	}
- *	actions {
- *		ACTION_NAME [ @tableonly | @defaultonly ]
- *		...
- *	}
- *	default_action ACTION_NAME args none | ARG0_NAME ARG0_VALUE ... [ const ]
- *	instanceof TABLE_TYPE_NAME
- *	pragma ARGS
- *	size SIZE
- * }
  */
-struct table_spec {
-	char *name;
-	struct rte_swx_pipeline_table_params params;
-	char *recommended_table_type_name;
-	char *args;
-	uint32_t size;
-};
-
 static void
 table_spec_free(struct table_spec *s)
 {
@@ -1084,22 +1021,7 @@ table_block_parse(struct table_spec *s,
 /*
  * selector.
  *
- * selector SELECTOR_NAME {
- *	group_id FIELD_NAME
- *	selector {
- *		FIELD_NAME
- *		...
- *	}
- *	member_id FIELD_NAME
- *	n_groups N_GROUPS
- *	n_members_per_group N_MEMBERS_PER_GROUP
- * }
  */
-struct selector_spec {
-	char *name;
-	struct rte_swx_pipeline_selector_params params;
-};
-
 static void
 selector_spec_free(struct selector_spec *s)
 {
@@ -1385,31 +1307,7 @@ selector_block_parse(struct selector_spec *s,
 /*
  * learner.
  *
- * learner LEARNER_NAME {
- *	key {
- *		MATCH_FIELD_NAME
- *		...
- *	}
- *	actions {
- *		ACTION_NAME [ @tableonly | @defaultonly]
- *		...
- *	}
- *	default_action ACTION_NAME args none | ARG0_NAME ARG0_VALUE ... [ const ]
- *	size SIZE
- *	timeout {
- *		TIMEOUT_IN_SECONDS
- *		...
- *	}
- * }
  */
-struct learner_spec {
-	char *name;
-	struct rte_swx_pipeline_learner_params params;
-	uint32_t size;
-	uint32_t *timeout;
-	uint32_t n_timeouts;
-};
-
 static void
 learner_spec_free(struct learner_spec *s)
 {
@@ -1958,14 +1856,7 @@ learner_block_parse(struct learner_spec *s,
 /*
  * regarray.
  *
- * regarray NAME size SIZE initval INITVAL
  */
-struct regarray_spec {
-	char *name;
-	uint64_t init_val;
-	uint32_t size;
-};
-
 static void
 regarray_spec_free(struct regarray_spec *s)
 {
@@ -2033,13 +1924,7 @@ regarray_statement_parse(struct regarray_spec *s,
 /*
  * metarray.
  *
- * metarray NAME size SIZE
  */
-struct metarray_spec {
-	char *name;
-	uint32_t size;
-};
-
 static void
 metarray_spec_free(struct metarray_spec *s)
 {
@@ -2095,16 +1980,7 @@ metarray_statement_parse(struct metarray_spec *s,
 /*
  * apply.
  *
- * apply {
- *	INSTRUCTION
- *	...
- * }
  */
-struct apply_spec {
-	const char **instructions;
-	uint32_t n_instructions;
-};
-
 static void
 apply_spec_free(struct apply_spec *s)
 {
diff --git a/lib/pipeline/rte_swx_pipeline_spec.h b/lib/pipeline/rte_swx_pipeline_spec.h
new file mode 100644
index 0000000000..8458de878a
--- /dev/null
+++ b/lib/pipeline/rte_swx_pipeline_spec.h
@@ -0,0 +1,176 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Intel Corporation
+ */
+#include <stdint.h>
+#include <stdio.h>
+
+#include <rte_common.h>
+
+#include <rte_swx_pipeline.h>
+
+/*
+ * extobj.
+ *
+ * extobj OBJ_NAME instanceof OBJ_TYPE [ pragma OBJ_CREATE_ARGS ]
+ */
+struct extobj_spec {
+	char *name;
+	char *extern_type_name;
+	char *pragma;
+};
+
+/*
+ * struct.
+ *
+ * struct STRUCT_TYPE_NAME {
+ *	bit<SIZE> | varbit<SIZE> FIELD_NAME
+ *	...
+ * }
+ */
+struct struct_spec {
+	char *name;
+	struct rte_swx_field_params *fields;
+	uint32_t n_fields;
+	int varbit;
+};
+
+/*
+ * header.
+ *
+ * header HEADER_NAME instanceof STRUCT_TYPE_NAME
+ */
+struct header_spec {
+	char *name;
+	char *struct_type_name;
+};
+
+/*
+ * metadata.
+ *
+ * metadata instanceof STRUCT_TYPE_NAME
+ */
+struct metadata_spec {
+	char *struct_type_name;
+};
+
+/*
+ * action.
+ *
+ * action ACTION_NAME args none | instanceof STRUCT_TYPE_NAME {
+ *	INSTRUCTION
+ *	...
+ * }
+ */
+struct action_spec {
+	char *name;
+	char *args_struct_type_name;
+	const char **instructions;
+	uint32_t n_instructions;
+};
+
+/*
+ * table.
+ *
+ * table TABLE_NAME {
+ *	key {
+ *		MATCH_FIELD_NAME exact | wildcard | lpm
+ *		...
+ *	}
+ *	actions {
+ *		ACTION_NAME [ @tableonly | @defaultonly ]
+ *		...
+ *	}
+ *	default_action ACTION_NAME args none | ARG0_NAME ARG0_VALUE ... [ const ]
+ *	instanceof TABLE_TYPE_NAME
+ *	pragma ARGS
+ *	size SIZE
+ * }
+ */
+struct table_spec {
+	char *name;
+	struct rte_swx_pipeline_table_params params;
+	char *recommended_table_type_name;
+	char *args;
+	uint32_t size;
+};
+
+/*
+ * selector.
+ *
+ * selector SELECTOR_NAME {
+ *	group_id FIELD_NAME
+ *	selector {
+ *		FIELD_NAME
+ *		...
+ *	}
+ *	member_id FIELD_NAME
+ *	n_groups N_GROUPS
+ *	n_members_per_group N_MEMBERS_PER_GROUP
+ * }
+ */
+struct selector_spec {
+	char *name;
+	struct rte_swx_pipeline_selector_params params;
+};
+
+/*
+ * learner.
+ *
+ * learner LEARNER_NAME {
+ *	key {
+ *		MATCH_FIELD_NAME
+ *		...
+ *	}
+ *	actions {
+ *		ACTION_NAME [ @tableonly | @defaultonly]
+ *		...
+ *	}
+ *	default_action ACTION_NAME args none | ARG0_NAME ARG0_VALUE ... [ const ]
+ *	size SIZE
+ *	timeout {
+ *		TIMEOUT_IN_SECONDS
+ *		...
+ *	}
+ * }
+ */
+struct learner_spec {
+	char *name;
+	struct rte_swx_pipeline_learner_params params;
+	uint32_t size;
+	uint32_t *timeout;
+	uint32_t n_timeouts;
+};
+
+/*
+ * regarray.
+ *
+ * regarray NAME size SIZE initval INITVAL
+ */
+struct regarray_spec {
+	char *name;
+	uint64_t init_val;
+	uint32_t size;
+};
+
+/*
+ * metarray.
+ *
+ * metarray NAME size SIZE
+ */
+struct metarray_spec {
+	char *name;
+	uint32_t size;
+};
+
+/*
+ * apply.
+ *
+ * apply {
+ *	INSTRUCTION
+ *	...
+ * }
+ */
+struct apply_spec {
+	const char **instructions;
+	uint32_t n_instructions;
+};
-- 
2.34.1


  parent reply	other threads:[~2022-07-28 15:12 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 13:07 [PATCH 1/9] " Cristian Dumitrescu
2022-07-18 13:07 ` [PATCH 2/9] pipeline: add pipeline specification data structure Cristian Dumitrescu
2022-07-18 13:07 ` [PATCH 3/9] pipeline: rework the specification file-based pipeline build Cristian Dumitrescu
2022-07-18 13:07 ` [PATCH 4/9] pipeline: generate the code for pipeline specification structure Cristian Dumitrescu
2022-07-18 13:07 ` [PATCH 5/9] pipeline: add API for pipeline code generation Cristian Dumitrescu
2022-07-18 13:07 ` [PATCH 6/9] pipeline: add API for shared library-based pipeline build Cristian Dumitrescu
2022-07-18 13:07 ` [PATCH 7/9] examples/pipeline: add CLI command for pipeline code generation Cristian Dumitrescu
2022-07-18 13:07 ` [PATCH 8/9] examples/pipeline: add CLI command for shared library build Cristian Dumitrescu
2022-07-18 13:07 ` [PATCH 9/9] examples/pipeline: call CLI commands for code generation and build Cristian Dumitrescu
2022-07-18 13:25 ` [PATCH V2 1/9] pipeline: move specification data structures to internal header Cristian Dumitrescu
2022-07-18 13:25   ` [PATCH V2 2/9] pipeline: add pipeline specification data structure Cristian Dumitrescu
2022-07-18 13:25   ` [PATCH V2 3/9] pipeline: rework the specification file-based pipeline build Cristian Dumitrescu
2022-07-18 13:25   ` [PATCH V2 4/9] pipeline: generate the code for pipeline specification structure Cristian Dumitrescu
2022-07-18 13:25   ` [PATCH V2 5/9] pipeline: add API for pipeline code generation Cristian Dumitrescu
2022-07-18 13:26   ` [PATCH V2 6/9] pipeline: add API for shared library-based pipeline build Cristian Dumitrescu
2022-07-18 13:26   ` [PATCH V2 7/9] examples/pipeline: add CLI command for pipeline code generation Cristian Dumitrescu
2022-07-18 13:26   ` [PATCH V2 8/9] examples/pipeline: add CLI command for shared library build Cristian Dumitrescu
2022-07-18 13:26   ` [PATCH V2 9/9] examples/pipeline: call CLI commands for code generation and build Cristian Dumitrescu
2022-07-27 22:36   ` [PATCH V3 01/17] pipeline: add pipeline name Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 02/17] pipeline: move specification data structures to internal header Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 03/17] pipeline: add pipeline specification data structure Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 04/17] pipeline: rework the specification file-based pipeline build Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 05/17] pipeline: generate the code for pipeline specification structure Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 06/17] pipeline: add support for pipeline I/O specification Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 07/17] pipeline: add API for pipeline code generation Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 08/17] pipeline: add API for shared library-based pipeline build Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 09/17] examples/pipeline: add CLI command for pipeline code generation Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 10/17] examples/pipeline: add CLI command for shared library build Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 11/17] examples/pipeline: remove the obsolete pipeline create CLI command Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 12/17] examples/pipeline: remove the obsolete port configuration CLI commands Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 13/17] examples/pipeline: remove the obsolete mirroring configuration CLI command Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 14/17] examples/pipeline: use the pipeline name query API Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 15/17] examples/pipeline: rework the link CLI command Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 16/17] examples/pipelines: remove obsolete tap " Cristian Dumitrescu
2022-07-27 22:36     ` [PATCH V3 17/17] examples/pipeline: call the code generation and build CLI commands Cristian Dumitrescu
2022-07-27 22:54     ` [PATCH V4 01/17] pipeline: add pipeline name Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 02/17] pipeline: move specification data structures to internal header Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 03/17] pipeline: add pipeline specification data structure Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 04/17] pipeline: rework the specification file-based pipeline build Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 05/17] pipeline: generate the code for pipeline specification structure Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 06/17] pipeline: add support for pipeline I/O specification Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 07/17] pipeline: add API for pipeline code generation Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 08/17] pipeline: add API for shared library-based pipeline build Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 09/17] examples/pipeline: add CLI command for pipeline code generation Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 10/17] examples/pipeline: add CLI command for shared library build Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 11/17] examples/pipeline: remove the obsolete pipeline create CLI command Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 12/17] examples/pipeline: remove the obsolete port configuration CLI commands Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 13/17] examples/pipeline: remove the obsolete mirroring configuration CLI command Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 14/17] examples/pipeline: use the pipeline name query API Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 15/17] examples/pipeline: rework the link CLI command Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 16/17] examples/pipelines: remove obsolete tap " Cristian Dumitrescu
2022-07-27 22:54       ` [PATCH V4 17/17] examples/pipeline: call the code generation and build CLI commands Cristian Dumitrescu
2022-07-27 23:01       ` [PATCH V5 01/17] pipeline: add pipeline name Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 02/17] pipeline: move specification data structures to internal header Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 03/17] pipeline: add pipeline specification data structure Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 04/17] pipeline: rework the specification file-based pipeline build Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 05/17] pipeline: generate the code for pipeline specification structure Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 06/17] pipeline: add support for pipeline I/O specification Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 07/17] pipeline: add API for pipeline code generation Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 08/17] pipeline: add API for shared library-based pipeline build Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 09/17] examples/pipeline: add CLI command for pipeline code generation Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 10/17] examples/pipeline: add CLI command for shared library build Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 11/17] examples/pipeline: remove the obsolete pipeline create CLI command Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 12/17] examples/pipeline: remove the obsolete port configuration CLI commands Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 13/17] examples/pipeline: remove the obsolete mirroring configuration CLI command Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 14/17] examples/pipeline: use the pipeline name query API Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 15/17] examples/pipeline: rework the link CLI command Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 16/17] examples/pipelines: remove obsolete tap " Cristian Dumitrescu
2022-07-27 23:01         ` [PATCH V5 17/17] examples/pipeline: call the code generation and build CLI commands Cristian Dumitrescu
2022-07-28  8:22         ` [PATCH V5 01/17] pipeline: add pipeline name Bruce Richardson
2022-07-28 15:17           ` Dumitrescu, Cristian
2022-07-28 15:11 ` [PATCH V6 00/17] pipeline: pipeline configuration and build improvements Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 01/17] pipeline: add pipeline name Cristian Dumitrescu
2022-07-28 15:11   ` Cristian Dumitrescu [this message]
2022-07-28 15:11   ` [PATCH V6 03/17] pipeline: add pipeline specification data structure Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 04/17] pipeline: rework the specification file-based pipeline build Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 05/17] pipeline: generate the code for pipeline specification structure Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 06/17] pipeline: add support for pipeline I/O specification Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 07/17] pipeline: add API for pipeline code generation Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 08/17] pipeline: add API for shared library-based pipeline build Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 09/17] examples/pipeline: add CLI command for pipeline code generation Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 10/17] examples/pipeline: add CLI command for shared library build Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 11/17] examples/pipeline: remove the obsolete pipeline create CLI command Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 12/17] examples/pipeline: remove the obsolete port configuration CLI commands Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 13/17] examples/pipeline: remove the obsolete mirroring configuration CLI command Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 14/17] examples/pipeline: use the pipeline name query API Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 15/17] examples/pipeline: rework the link CLI command Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 16/17] examples/pipelines: remove obsolete tap " Cristian Dumitrescu
2022-07-28 15:11   ` [PATCH V6 17/17] examples/pipeline: call the code generation and build CLI commands Cristian Dumitrescu
2022-09-15 15:54   ` [PATCH V6 00/17] pipeline: pipeline configuration and build improvements Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220728151147.603265-3-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=kamalakannan.r@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).