From patchwork Wed Jul 27 22:54:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114298 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1E30DA00C4; Thu, 28 Jul 2022 00:54:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A72842B75; Thu, 28 Jul 2022 00:54:38 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id C2CF44281E for ; Thu, 28 Jul 2022 00:54:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658962475; x=1690498475; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UzzpIhJ2abbRozU27BFdEHiHwKlZzXx+954EfyzY78c=; b=Ut1FZ3wEedI9Jl1yxU69/BnfrW+lXd6okDCCL7UY7LzmspjMFR5DcKHi J4bQnLy5K9iOmxZbWUYLxA5bP6UFamHIuewiaM/5OYQm00PNEHvDKpgGI rk5XeKq2YLwDIuKVOzeik6dAgkbCBL2+xO3ENxkO4CGzhCELlAN/aKyy3 CLFVCquc144dfZXy6ov6EbZnC5Oq/fWFSHfIkAUZ0ulc1Gf1039dzLxFv v4nCt+8AX+bpgJtfZrv4zAi5M/paMOWJBOHZSH5DG9nDl5WoSHXuL5GR1 HAkOLI757xc9Kvg0HUX899qiY0jGfkk0pPdxaO+glPdKD0q480cM4WIZP Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10421"; a="285912155" X-IronPort-AV: E=Sophos;i="5.93,196,1654585200"; d="scan'208";a="285912155" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 15:54:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,196,1654585200"; d="scan'208";a="628572570" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com.) ([10.237.223.157]) by orsmga008.jf.intel.com with ESMTP; 27 Jul 2022 15:54:34 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: "Kamalakannan R ." Subject: [PATCH V4 03/17] pipeline: add pipeline specification data structure Date: Wed, 27 Jul 2022 22:54:17 +0000 Message-Id: <20220727225431.600913-3-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220727225431.600913-1-cristian.dumitrescu@intel.com> References: <20220727223639.598932-1-cristian.dumitrescu@intel.com> <20220727225431.600913-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 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);