Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/98631/?format=api
http://patches.dpdk.org/api/patches/98631/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210910123003.85448-23-cristian.dumitrescu@intel.com/", "project": { "id": 1, "url": "http://patches.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": "<20210910123003.85448-23-cristian.dumitrescu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210910123003.85448-23-cristian.dumitrescu@intel.com", "date": "2021-09-10T12:30:02", "name": "[23/24] pipeline: build shared object for pipeline", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "820c43c516f92f460d4e38b1fc2b8e590e96dacb", "submitter": { "id": 19, "url": "http://patches.dpdk.org/api/people/19/?format=api", "name": "Cristian Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210910123003.85448-23-cristian.dumitrescu@intel.com/mbox/", "series": [ { "id": 18838, "url": "http://patches.dpdk.org/api/series/18838/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18838", "date": "2021-09-10T12:29:44", "name": "[01/24] pipeline: move data structures to internal header file", "version": 1, "mbox": "http://patches.dpdk.org/series/18838/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/98631/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/98631/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 70705A0547;\n\tFri, 10 Sep 2021 14:33:31 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7A0AE411EE;\n\tFri, 10 Sep 2021 14:30:58 +0200 (CEST)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 8839D4114B\n for <dev@dpdk.org>; Fri, 10 Sep 2021 14:30:28 +0200 (CEST)", "from orsmga001.jf.intel.com ([10.7.209.18])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 10 Sep 2021 05:30:25 -0700", "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by orsmga001.jf.intel.com with ESMTP; 10 Sep 2021 05:30:25 -0700" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10102\"; a=\"243386340\"", "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"243386340\"", "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"514279860\"" ], "X-ExtLoop1": "1", "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>", "To": "dev@dpdk.org", "Cc": "Cunming Liang <cunming.liang@intel.com>", "Date": "Fri, 10 Sep 2021 13:30:02 +0100", "Message-Id": "<20210910123003.85448-23-cristian.dumitrescu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20210910123003.85448-1-cristian.dumitrescu@intel.com>", "References": "<20210910123003.85448-1-cristian.dumitrescu@intel.com>", "Subject": "[dpdk-dev] [PATCH 23/24] pipeline: build shared object for pipeline", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Build the generated C file into a shared object library.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Cunming Liang <cunming.liang@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c | 131 +++++++++++++++++++++++\n lib/pipeline/rte_swx_pipeline_internal.h | 1 +\n 2 files changed, 132 insertions(+)", "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex 0a4ac06467..4be43c94a9 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -5,6 +5,7 @@\n #include <stdio.h>\n #include <errno.h>\n #include <arpa/inet.h>\n+#include <dlfcn.h>\n \n #include \"rte_swx_pipeline_internal.h\"\n \n@@ -8945,9 +8946,13 @@ rte_swx_pipeline_config(struct rte_swx_pipeline **p, int numa_node)\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@@ -8967,6 +8972,9 @@ rte_swx_pipeline_free(struct rte_swx_pipeline *p)\n \tstruct_free(p);\n \n \tfree(p);\n+\n+\tif (lib)\n+\t\tdlclose(lib);\n }\n \n int\n@@ -12178,6 +12186,124 @@ pipeline_codegen(struct rte_swx_pipeline *p, struct instruction_group_list *igl)\n \treturn 0;\n }\n \n+#ifndef RTE_SWX_PIPELINE_CMD_MAX_SIZE\n+#define RTE_SWX_PIPELINE_CMD_MAX_SIZE 4096\n+#endif\n+\n+static int\n+pipeline_libload(struct rte_swx_pipeline *p, struct instruction_group_list *igl)\n+{\n+\tstruct action *a;\n+\tstruct instruction_group *g;\n+\tchar *dir_in, *buffer = NULL;\n+\tconst char *dir_out;\n+\tint status = 0;\n+\n+\t/* Get the environment variables. */\n+\tdir_in = getenv(\"RTE_INSTALL_DIR\");\n+\tif (!dir_in) {\n+\t\tstatus = -EINVAL;\n+\t\tgoto free;\n+\t}\n+\n+\tdir_out = \"/tmp\";\n+\n+\t/* Memory allocation for the command buffer. */\n+\tbuffer = malloc(RTE_SWX_PIPELINE_CMD_MAX_SIZE);\n+\tif (!buffer) {\n+\t\tstatus = -ENOMEM;\n+\t\tgoto free;\n+\t}\n+\n+\tsnprintf(buffer,\n+\t\t RTE_SWX_PIPELINE_CMD_MAX_SIZE,\n+\t\t \"gcc -c -O3 -fpic -Wno-deprecated-declarations -o %s/pipeline.o %s/pipeline.c \"\n+\t\t \"-I %s/lib/pipeline \"\n+\t\t \"-I %s/lib/eal/include \"\n+\t\t \"-I %s/lib/eal/x86/include \"\n+\t\t \"-I %s/lib/eal/include/generic \"\n+\t\t \"-I %s/lib/meter \"\n+\t\t \"-I %s/lib/port \"\n+\t\t \"-I %s/lib/table \"\n+\t\t \"-I %s/lib/pipeline \"\n+\t\t \"-I %s/config \"\n+\t\t \"-I %s/build \"\n+\t\t \"-I %s/lib/eal/linux/include \"\n+\t\t \">%s/pipeline.log 2>&1 \"\n+\t\t \"&& \"\n+\t\t \"gcc -shared %s/pipeline.o -o %s/libpipeline.so \"\n+\t\t \">>%s/pipeline.log 2>&1\",\n+\t\t dir_out,\n+\t\t dir_out,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_in,\n+\t\t dir_out,\n+\t\t dir_out,\n+\t\t dir_out,\n+\t\t dir_out);\n+\n+\t/* Build the shared object library. */\n+\tstatus = system(buffer);\n+\tif (status)\n+\t\tgoto free;\n+\n+\t/* Open library. */\n+\tsnprintf(buffer,\n+\t\t RTE_SWX_PIPELINE_CMD_MAX_SIZE,\n+\t\t \"%s/libpipeline.so\",\n+\t\t dir_out);\n+\n+\tp->lib = dlopen(buffer, RTLD_LAZY);\n+\tif (!p->lib) {\n+\t\tstatus = -EIO;\n+\t\tgoto free;\n+\t}\n+\n+\t/* Get the action function symbols. */\n+\tTAILQ_FOREACH(a, &p->actions, node) {\n+\t\tsnprintf(buffer, RTE_SWX_PIPELINE_CMD_MAX_SIZE, \"action_%s_run\", a->name);\n+\n+\t\tp->action_funcs[a->id] = dlsym(p->lib, buffer);\n+\t\tif (!p->action_funcs[a->id]) {\n+\t\t\tstatus = -EINVAL;\n+\t\t\tgoto free;\n+\t\t}\n+\t}\n+\n+\t/* Get the pipeline function symbols. */\n+\tTAILQ_FOREACH(g, igl, node) {\n+\t\tif (g->first_instr_id == g->last_instr_id)\n+\t\t\tcontinue;\n+\n+\t\tsnprintf(buffer, RTE_SWX_PIPELINE_CMD_MAX_SIZE, \"pipeline_func_%u\", g->group_id);\n+\n+\t\tg->func = dlsym(p->lib, buffer);\n+\t\tif (!g->func) {\n+\t\t\tstatus = -EINVAL;\n+\t\t\tgoto free;\n+\t\t}\n+\t}\n+\n+free:\n+\tif (status && p->lib) {\n+\t\tdlclose(p->lib);\n+\t\tp->lib = NULL;\n+\t}\n+\n+\tfree(buffer);\n+\n+\treturn status;\n+}\n+\n static int\n pipeline_compile(struct rte_swx_pipeline *p)\n {\n@@ -12195,6 +12321,11 @@ pipeline_compile(struct rte_swx_pipeline *p)\n \tif (status)\n \t\tgoto free;\n \n+\t/* Build and load the shared object library. */\n+\tstatus = pipeline_libload(p, igl);\n+\tif (status)\n+\t\tgoto free;\n+\n free:\n \tinstruction_group_list_free(igl);\n \ndiff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h\nindex 4ad6dd42dd..a210df4856 100644\n--- a/lib/pipeline/rte_swx_pipeline_internal.h\n+++ b/lib/pipeline/rte_swx_pipeline_internal.h\n@@ -1400,6 +1400,7 @@ struct rte_swx_pipeline {\n \tstruct instruction *instructions;\n \tstruct instruction_data *instruction_data;\n \tstruct thread threads[RTE_SWX_PIPELINE_THREADS_MAX];\n+\tvoid *lib;\n \n \tuint32_t n_structs;\n \tuint32_t n_ports_in;\n", "prefixes": [ "23/24" ] }{ "id": 98631, "url": "