Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/104723/?format=api
http://patchwork.dpdk.org/api/patches/104723/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20211127000254.36148-2-cristian.dumitrescu@intel.com/", "project": { "id": 1, "url": "http://patchwork.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20211127000254.36148-2-cristian.dumitrescu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20211127000254.36148-2-cristian.dumitrescu@intel.com", "date": "2021-11-27T00:02:52", "name": "[V2,2/4] pipeline: move port type registration to library", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "54e64c6843c4a83959ebf2b36d967a272766012a", "submitter": { "id": 19, "url": "http://patchwork.dpdk.org/api/people/19/?format=api", "name": "Cristian Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20211127000254.36148-2-cristian.dumitrescu@intel.com/mbox/", "series": [ { "id": 20794, "url": "http://patchwork.dpdk.org/api/series/20794/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=20794", "date": "2021-11-27T00:02:51", "name": "[V2,1/4] pipeline: improve the drop instruction", "version": 2, "mbox": "http://patchwork.dpdk.org/series/20794/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/104723/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/104723/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 2CDCCA0C43;\n\tSat, 27 Nov 2021 01:03:04 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 069D342749;\n\tSat, 27 Nov 2021 01:03:00 +0100 (CET)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 255C34068A\n for <dev@dpdk.org>; Sat, 27 Nov 2021 01:02:57 +0100 (CET)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Nov 2021 16:02:57 -0800", "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by fmsmga001.fm.intel.com with ESMTP; 26 Nov 2021 16:02:56 -0800" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10180\"; a=\"215751234\"", "E=Sophos;i=\"5.87,267,1631602800\"; d=\"scan'208\";a=\"215751234\"", "E=Sophos;i=\"5.87,267,1631602800\"; d=\"scan'208\";a=\"652292974\"" ], "X-ExtLoop1": "1", "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>", "To": "dev@dpdk.org", "Cc": "yogesh.jangra@intel.com", "Subject": "[PATCH V2 2/4] pipeline: move port type registration to library", "Date": "Sat, 27 Nov 2021 00:02:52 +0000", "Message-Id": "<20211127000254.36148-2-cristian.dumitrescu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20211127000254.36148-1-cristian.dumitrescu@intel.com>", "References": "<20211126235129.35781-1-cristian.dumitrescu@intel.com>\n <20211127000254.36148-1-cristian.dumitrescu@intel.com>", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Move the port type registration for the well known port types from the\napplication to the pipeline library.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Yogesh Jangra <yogesh.jangra@intel.com>\n---\n examples/pipeline/obj.c | 54 -----------\n lib/pipeline/rte_swx_pipeline.c | 159 ++++++++++++++++++++++++--------\n 2 files changed, 123 insertions(+), 90 deletions(-)", "diff": "diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c\nindex 569207a79d..4b2db66c46 100644\n--- a/examples/pipeline/obj.c\n+++ b/examples/pipeline/obj.c\n@@ -16,10 +16,6 @@\n #include <rte_mempool.h>\n #include <rte_mbuf.h>\n #include <rte_ethdev.h>\n-#include <rte_swx_port_ethdev.h>\n-#include <rte_swx_port_fd.h>\n-#include <rte_swx_port_ring.h>\n-#include <rte_swx_port_source_sink.h>\n #include <rte_swx_table_em.h>\n #include <rte_swx_table_wm.h>\n #include <rte_swx_pipeline.h>\n@@ -543,56 +539,6 @@ pipeline_create(struct obj *obj, const char *name, int numa_node)\n \tif (status)\n \t\tgoto error;\n \n-\tstatus = rte_swx_pipeline_port_in_type_register(p,\n-\t\t\"ethdev\",\n-\t\t&rte_swx_port_ethdev_reader_ops);\n-\tif (status)\n-\t\tgoto error;\n-\n-\tstatus = rte_swx_pipeline_port_out_type_register(p,\n-\t\t\"ethdev\",\n-\t\t&rte_swx_port_ethdev_writer_ops);\n-\tif (status)\n-\t\tgoto error;\n-\n-\tstatus = rte_swx_pipeline_port_in_type_register(p,\n-\t\t\"ring\",\n-\t\t&rte_swx_port_ring_reader_ops);\n-\tif (status)\n-\t\tgoto error;\n-\n-\tstatus = rte_swx_pipeline_port_out_type_register(p,\n-\t\t\"ring\",\n-\t\t&rte_swx_port_ring_writer_ops);\n-\tif (status)\n-\t\tgoto error;\n-\n-#ifdef RTE_PORT_PCAP\n-\tstatus = rte_swx_pipeline_port_in_type_register(p,\n-\t\t\"source\",\n-\t\t&rte_swx_port_source_ops);\n-\tif (status)\n-\t\tgoto error;\n-#endif\n-\n-\tstatus = rte_swx_pipeline_port_out_type_register(p,\n-\t\t\"sink\",\n-\t\t&rte_swx_port_sink_ops);\n-\tif (status)\n-\t\tgoto error;\n-\n-\tstatus = rte_swx_pipeline_port_in_type_register(p,\n-\t\t\"fd\",\n-\t\t&rte_swx_port_fd_reader_ops);\n-\tif (status)\n-\t\tgoto error;\n-\n-\tstatus = rte_swx_pipeline_port_out_type_register(p,\n-\t\t\"fd\",\n-\t\t&rte_swx_port_fd_writer_ops);\n-\tif (status)\n-\t\tgoto error;\n-\n \tstatus = rte_swx_pipeline_table_type_register(p,\n \t\t\"exact\",\n \t\tRTE_SWX_TABLE_MATCH_EXACT,\ndiff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex ff2fe964a5..bebad98e99 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -7,6 +7,11 @@\n #include <arpa/inet.h>\n #include <dlfcn.h>\n \n+#include <rte_swx_port_ethdev.h>\n+#include <rte_swx_port_fd.h>\n+#include <rte_swx_port_ring.h>\n+#include \"rte_swx_port_source_sink.h\"\n+\n #include \"rte_swx_pipeline_internal.h\"\n \n #define CHECK(condition, err_code) \\\n@@ -8982,17 +8987,122 @@ metarray_free(struct rte_swx_pipeline *p)\n /*\n * Pipeline.\n */\n+void\n+rte_swx_pipeline_free(struct rte_swx_pipeline *p)\n+{\n+\tvoid *lib;\n+\n+\tif (!p)\n+\t\treturn;\n+\n+\tlib = p->lib;\n+\n+\tfree(p->instruction_data);\n+\tfree(p->instructions);\n+\n+\tmetarray_free(p);\n+\tregarray_free(p);\n+\ttable_state_free(p);\n+\tlearner_free(p);\n+\tselector_free(p);\n+\ttable_free(p);\n+\taction_free(p);\n+\tinstruction_table_free(p);\n+\tmetadata_free(p);\n+\theader_free(p);\n+\textern_func_free(p);\n+\textern_obj_free(p);\n+\tport_out_free(p);\n+\tport_in_free(p);\n+\tstruct_free(p);\n+\n+\tfree(p);\n+\n+\tif (lib)\n+\t\tdlclose(lib);\n+}\n+\n+static int\n+port_in_types_register(struct rte_swx_pipeline *p)\n+{\n+\tint status;\n+\n+\tstatus = rte_swx_pipeline_port_in_type_register(p,\n+\t\t\"ethdev\",\n+\t\t&rte_swx_port_ethdev_reader_ops);\n+\tif (status)\n+\t\treturn status;\n+\n+\tstatus = rte_swx_pipeline_port_in_type_register(p,\n+\t\t\"ring\",\n+\t\t&rte_swx_port_ring_reader_ops);\n+\tif (status)\n+\t\treturn status;\n+\n+#ifdef RTE_PORT_PCAP\n+\tstatus = rte_swx_pipeline_port_in_type_register(p,\n+\t\t\"source\",\n+\t\t&rte_swx_port_source_ops);\n+\tif (status)\n+\t\treturn status;\n+#endif\n+\n+\tstatus = rte_swx_pipeline_port_in_type_register(p,\n+\t\t\"fd\",\n+\t\t&rte_swx_port_fd_reader_ops);\n+\tif (status)\n+\t\treturn status;\n+\n+\treturn 0;\n+}\n+\n+static int\n+port_out_types_register(struct rte_swx_pipeline *p)\n+{\n+\tint status;\n+\n+\tstatus = rte_swx_pipeline_port_out_type_register(p,\n+\t\t\"ethdev\",\n+\t\t&rte_swx_port_ethdev_writer_ops);\n+\tif (status)\n+\t\treturn status;\n+\n+\tstatus = rte_swx_pipeline_port_out_type_register(p,\n+\t\t\"ring\",\n+\t\t&rte_swx_port_ring_writer_ops);\n+\tif (status)\n+\t\treturn status;\n+\n+\tstatus = rte_swx_pipeline_port_out_type_register(p,\n+\t\t\"sink\",\n+\t\t&rte_swx_port_sink_ops);\n+\tif (status)\n+\t\treturn status;\n+\n+\tstatus = rte_swx_pipeline_port_out_type_register(p,\n+\t\t\"fd\",\n+\t\t&rte_swx_port_fd_writer_ops);\n+\tif (status)\n+\t\treturn status;\n+\n+\treturn 0;\n+}\n+\n int\n rte_swx_pipeline_config(struct rte_swx_pipeline **p, int numa_node)\n {\n-\tstruct rte_swx_pipeline *pipeline;\n+\tstruct rte_swx_pipeline *pipeline = NULL;\n+\tint status = 0;\n \n \t/* Check input parameters. */\n \tCHECK(p, EINVAL);\n \n \t/* Memory allocation. */\n \tpipeline = calloc(1, sizeof(struct rte_swx_pipeline));\n-\tCHECK(pipeline, ENOMEM);\n+\tif (!pipeline) {\n+\t\tstatus = -ENOMEM;\n+\t\tgoto error;\n+\t}\n \n \t/* Initialization. */\n \tTAILQ_INIT(&pipeline->struct_types);\n@@ -9016,43 +9126,20 @@ rte_swx_pipeline_config(struct rte_swx_pipeline **p, int numa_node)\n \tpipeline->n_structs = 1; /* Struct 0 is reserved for action_data. */\n \tpipeline->numa_node = numa_node;\n \n-\t*p = pipeline;\n-\treturn 0;\n-}\n-\n-void\n-rte_swx_pipeline_free(struct rte_swx_pipeline *p)\n-{\n-\tvoid *lib;\n-\n-\tif (!p)\n-\t\treturn;\n-\n-\tlib = p->lib;\n-\n-\tfree(p->instruction_data);\n-\tfree(p->instructions);\n+\tstatus = port_in_types_register(pipeline);\n+\tif (status)\n+\t\tgoto error;\n \n-\tmetarray_free(p);\n-\tregarray_free(p);\n-\ttable_state_free(p);\n-\tlearner_free(p);\n-\tselector_free(p);\n-\ttable_free(p);\n-\taction_free(p);\n-\tinstruction_table_free(p);\n-\tmetadata_free(p);\n-\theader_free(p);\n-\textern_func_free(p);\n-\textern_obj_free(p);\n-\tport_out_free(p);\n-\tport_in_free(p);\n-\tstruct_free(p);\n+\tstatus = port_out_types_register(pipeline);\n+\tif (status)\n+\t\tgoto error;\n \n-\tfree(p);\n+\t*p = pipeline;\n+\treturn 0;\n \n-\tif (lib)\n-\t\tdlclose(lib);\n+error:\n+\trte_swx_pipeline_free(pipeline);\n+\treturn status;\n }\n \n int\n", "prefixes": [ "V2", "2/4" ] }{ "id": 104723, "url": "