get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/114031/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 114031,
    "url": "https://patches.dpdk.org/api/patches/114031/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220718132603.339314-5-cristian.dumitrescu@intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20220718132603.339314-5-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220718132603.339314-5-cristian.dumitrescu@intel.com",
    "date": "2022-07-18T13:25:59",
    "name": "[V2,5/9] pipeline: add API for pipeline code generation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "08e38a1bb4318a864a4ea7e9f2c5ce42d2424b73",
    "submitter": {
        "id": 19,
        "url": "https://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220718132603.339314-5-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 24021,
            "url": "https://patches.dpdk.org/api/series/24021/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24021",
            "date": "2022-07-18T13:25:55",
            "name": "[V2,1/9] pipeline: move specification data structures to internal header",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/24021/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/114031/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/114031/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 B1D8CA0032;\n\tMon, 18 Jul 2022 15:26:38 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id A40E642826;\n\tMon, 18 Jul 2022 15:26:19 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id 6E0C44069F\n for <dev@dpdk.org>; Mon, 18 Jul 2022 15:26:15 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 18 Jul 2022 06:26:10 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com.) ([10.237.223.157])\n by fmsmga008.fm.intel.com with ESMTP; 18 Jul 2022 06:26:09 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1658150775; x=1689686775;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=2xtKH5YwBNH0YtSD96L/IjrRVQtxD+BIloqcSzc/ybk=;\n b=OWGwGAgSfBhMS4de5Z8a1cxfi08fapA/cwMzt2E9hfUvehIqkJg3hR4U\n BuRtVykde8k1cZ85amk4A4gP5lbHJwrJrp72K3Ozt30MGLjtaoH8srmp7\n H27b2Kq1QvMSQ0WsKGPpBuBkC+wg10/ZlfxfMj2UlRO2Ur3G5hz4IKGmM\n 4wOcLXc0wuWzCWeZ3VBicCUvbr1mA5HPcC/yAdXBBrdYN8/RDsvyqfrMN\n ZJjY+rfOaWY0y1PO/FQgZZu7mmZIUAY6wTb/IfpYFCjBfDT2VIbSEs8qA\n ULHVUibMoVL4zYiu/baLTRtq6M3+eXqKjAFK1NQ23WwLHM3xy0jacacpX A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10411\"; a=\"284974529\"",
            "E=Sophos;i=\"5.92,281,1650956400\"; d=\"scan'208\";a=\"284974529\"",
            "E=Sophos;i=\"5.92,281,1650956400\"; d=\"scan'208\";a=\"655275274\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "\"Kamalakannan R .\" <kamalakannan.r@intel.com>",
        "Subject": "[PATCH V2 5/9] pipeline: add API for pipeline code generation",
        "Date": "Mon, 18 Jul 2022 13:25:59 +0000",
        "Message-Id": "<20220718132603.339314-5-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220718132603.339314-1-cristian.dumitrescu@intel.com>",
        "References": "<20220718130713.339003-1-cristian.dumitrescu@intel.com>\n <20220718132603.339314-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 <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": "Previously, the C code generation for the pipeline was hidden under\nthe hood; now, we make this an explicit API operation. Besides the\nfunctions for the pipeline actions and the pipeline instructions,\nthe generated C source code now includes the pipeline specification\nstructure required for the pipeline configuration operations.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Kamalakannan R. <kamalakannan.r@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c | 94 +++++++++++++++++++++++++++++++++\n lib/pipeline/rte_swx_pipeline.h | 25 +++++++++\n lib/pipeline/version.map        |  3 ++\n 3 files changed, 122 insertions(+)",
    "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex 3e1c6e9edb..52760111fd 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -18,6 +18,7 @@\n #include <rte_swx_table_wm.h>\n \n #include \"rte_swx_pipeline_internal.h\"\n+#include \"rte_swx_pipeline_spec.h\"\n \n #define CHECK(condition, err_code)                                             \\\n do {                                                                           \\\n@@ -13476,3 +13477,96 @@ pipeline_compile(struct rte_swx_pipeline *p)\n \n \treturn status;\n }\n+\n+int\n+rte_swx_pipeline_codegen(FILE *spec_file,\n+\t\t\t FILE *code_file,\n+\t\t\t uint32_t *err_line,\n+\t\t\t const char **err_msg)\n+\n+{\n+\tstruct rte_swx_pipeline *p = NULL;\n+\tstruct pipeline_spec *s = NULL;\n+\tstruct instruction_group_list *igl = NULL;\n+\tstruct action *a;\n+\tint status = 0;\n+\n+\t/* Check input arguments. */\n+\tif (!spec_file || !code_file) {\n+\t\tif (err_line)\n+\t\t\t*err_line = 0;\n+\t\tif (err_msg)\n+\t\t\t*err_msg = \"Invalid input argument.\";\n+\t\tstatus = -EINVAL;\n+\t\tgoto free;\n+\t}\n+\n+\t/* Pipeline configuration. */\n+\ts = pipeline_spec_parse(spec_file, err_line, err_msg);\n+\tif (!s) {\n+\t\tstatus = -EINVAL;\n+\t\tgoto free;\n+\t}\n+\n+\tstatus = rte_swx_pipeline_config(&p, 0);\n+\tif (status) {\n+\t\tif (err_line)\n+\t\t\t*err_line = 0;\n+\t\tif (err_msg)\n+\t\t\t*err_msg = \"Pipeline configuration error.\";\n+\t\tgoto free;\n+\t}\n+\n+\tstatus = pipeline_spec_configure(p, s, err_msg);\n+\tif (status) {\n+\t\tif (err_line)\n+\t\t\t*err_line = 0;\n+\t\tgoto free;\n+\t}\n+\n+\t/*\n+\t * Pipeline code generation.\n+\t */\n+\n+\t/* Instruction Group List (IGL) computation: the pipeline configuration must be done first,\n+\t * but there is no need for the pipeline build to be done as well.\n+\t */\n+\tigl = instruction_group_list_create(p);\n+\tif (!igl) {\n+\t\tif (err_line)\n+\t\t\t*err_line = 0;\n+\t\tif (err_msg)\n+\t\t\t*err_msg = \"Memory allocation failed.\";\n+\t\tstatus = -ENOMEM;\n+\t\tgoto free;\n+\t}\n+\n+\t/* Header file inclusion. */\n+\tfprintf(code_file, \"#include \\\"rte_swx_pipeline_internal.h\\\"\\n\");\n+\tfprintf(code_file, \"#include \\\"rte_swx_pipeline_spec.h\\\"\\n\\n\");\n+\n+\t/* Code generation for the pipeline specification. */\n+\tpipeline_spec_codegen(code_file, s);\n+\tfprintf(code_file, \"\\n\");\n+\n+\t/* Code generation for the action instructions. */\n+\tTAILQ_FOREACH(a, &p->actions, node) {\n+\t\tfprintf(code_file, \"/**\\n * Action %s\\n */\\n\\n\", a->name);\n+\n+\t\taction_data_codegen(a, code_file);\n+\t\tfprintf(code_file, \"\\n\");\n+\n+\t\taction_instr_codegen(a, code_file);\n+\t\tfprintf(code_file, \"\\n\");\n+\t}\n+\n+\t/* Code generation for the pipeline instructions. */\n+\tinstruction_group_list_codegen(igl, p, code_file);\n+\n+free:\n+\tinstruction_group_list_free(igl);\n+\trte_swx_pipeline_free(p);\n+\tpipeline_spec_free(s);\n+\n+\treturn status;\n+}\ndiff --git a/lib/pipeline/rte_swx_pipeline.h b/lib/pipeline/rte_swx_pipeline.h\nindex c41ca5cb15..2bd019b05f 100644\n--- a/lib/pipeline/rte_swx_pipeline.h\n+++ b/lib/pipeline/rte_swx_pipeline.h\n@@ -941,6 +941,31 @@ __rte_experimental\n int\n rte_swx_pipeline_build(struct rte_swx_pipeline *p);\n \n+/**\n+ * Pipeline C code generate based on input specification file\n+ *\n+ * @param[in] spec_file\n+ *   Pipeline specification file (.spec) provided as input.\n+ * @param[in] code_file\n+ *   Pipeline C language file (.c) to be generated.\n+ * @param[out] err_line\n+ *   In case of error and non-NULL, the line number within the *spec* file where\n+ *   the error occurred. The first line number in the file is 1.\n+ * @param[out] err_msg\n+ *   In case of error and non-NULL, the error message.\n+ * @return\n+ *   0 on success or the following error codes otherwise:\n+ *   -EINVAL: Invalid argument;\n+ *   -ENOMEM: Not enough space/cannot allocate memory;\n+ *   -EEXIST: Resource with the same name already exists.\n+ */\n+__rte_experimental\n+int\n+rte_swx_pipeline_codegen(FILE *spec_file,\n+\t\t\t FILE *code_file,\n+\t\t\t uint32_t *err_line,\n+\t\t\t const char **err_msg);\n+\n /**\n  * Pipeline build from specification file\n  *\ndiff --git a/lib/pipeline/version.map b/lib/pipeline/version.map\nindex 8312307a7a..51165d48cf 100644\n--- a/lib/pipeline/version.map\n+++ b/lib/pipeline/version.map\n@@ -145,4 +145,7 @@ EXPERIMENTAL {\n \trte_swx_ctl_pipeline_learner_timeout_get;\n \trte_swx_ctl_pipeline_learner_timeout_set;\n \trte_swx_pipeline_hash_func_register;\n+\n+\t#added in 22.11\n+\trte_swx_pipeline_codegen;\n };\n",
    "prefixes": [
        "V2",
        "5/9"
    ]
}