From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D6B39A0032; Mon, 18 Jul 2022 15:07:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EF4BD410E6; Mon, 18 Jul 2022 15:07:20 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id B59B040041 for ; Mon, 18 Jul 2022 15:07:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658149637; x=1689685637; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UzzpIhJ2abbRozU27BFdEHiHwKlZzXx+954EfyzY78c=; b=CuyKmfKjB2jgmqNzLJw1L9Fh309fBgnCg9ax9ihKUDyLkqg5Djr7Ambv TWLemuDGSR/PkLrQx/vGAHFO5zAWriq9UWPO/aU4tfCnb88cK4+NPOpta V9N+pOL51yg8U17HYaGC6Aelgp7Ch8/GDwb6o5mW6lLfdpdksspzJ6G+u MdwenBnpfcbPYFl/MrpXfBnirgpIl3ye5QnppFSD0tIjCWDxT8uFykm6y 7jb3k9OminMcoEWUTeJwZPFErZOzIpP48Y7N1T79K94Vfrf1WbX8Xzj+/ B84Sc0EhB8qV/dljA2l6PHpyg1a7/U3GBRie3H1bv4Njzl2qBCsTE1eUj Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10411"; a="265996399" X-IronPort-AV: E=Sophos;i="5.92,281,1650956400"; d="scan'208";a="265996399" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 06:07:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,281,1650956400"; d="scan'208";a="739459728" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com.) ([10.237.223.157]) by fmsmga001.fm.intel.com with ESMTP; 18 Jul 2022 06:07:15 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: "Kamalakannan R ." Subject: [PATCH 2/9] pipeline: add pipeline specification data structure Date: Mon, 18 Jul 2022 13:07:06 +0000 Message-Id: <20220718130713.339003-2-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220718130713.339003-1-cristian.dumitrescu@intel.com> References: <20220718130713.339003-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add specification data structure for the entire pipeline. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R. --- lib/pipeline/rte_swx_pipeline_spec.c | 21 ++++++++++++++++++ lib/pipeline/rte_swx_pipeline_spec.h | 32 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/lib/pipeline/rte_swx_pipeline_spec.c b/lib/pipeline/rte_swx_pipeline_spec.c index 5e07b4f794..642091b678 100644 --- a/lib/pipeline/rte_swx_pipeline_spec.c +++ b/lib/pipeline/rte_swx_pipeline_spec.c @@ -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, diff --git a/lib/pipeline/rte_swx_pipeline_spec.h b/lib/pipeline/rte_swx_pipeline_spec.h index 8458de878a..e1170a33b1 100644 --- a/lib/pipeline/rte_swx_pipeline_spec.h +++ b/lib/pipeline/rte_swx_pipeline_spec.h @@ -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); -- 2.34.1