get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 98788,
    "url": "http://patches.dpdk.org/api/patches/98788/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210913164443.16875-18-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": "<20210913164443.16875-18-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210913164443.16875-18-cristian.dumitrescu@intel.com",
    "date": "2021-09-13T16:44:37",
    "name": "[V3,18/24] pipeline: introduce custom instructions",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8e1cd73a1e6d0f465d7f06904e59b49aee4e23d0",
    "submitter": {
        "id": 19,
        "url": "http://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210913164443.16875-18-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 18878,
            "url": "http://patches.dpdk.org/api/series/18878/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18878",
            "date": "2021-09-13T16:44:20",
            "name": "[V3,01/24] pipeline: move data structures to internal header file",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/18878/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/98788/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/98788/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 154A1A0C45;\n\tMon, 13 Sep 2021 18:46:53 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 39BFB4119B;\n\tMon, 13 Sep 2021 18:45:10 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 39F6941178\n for <dev@dpdk.org>; Mon, 13 Sep 2021 18:45:05 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Sep 2021 09:45:04 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by fmsmga008.fm.intel.com with ESMTP; 13 Sep 2021 09:45:03 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10106\"; a=\"201239164\"",
            "E=Sophos;i=\"5.85,290,1624345200\"; d=\"scan'208\";a=\"201239164\"",
            "E=Sophos;i=\"5.85,290,1624345200\"; d=\"scan'208\";a=\"507429224\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 13 Sep 2021 17:44:37 +0100",
        "Message-Id": "<20210913164443.16875-18-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20210913164443.16875-1-cristian.dumitrescu@intel.com>",
        "References": "<20210910133713.93103-1-cristian.dumitrescu@intel.com>\n <20210913164443.16875-1-cristian.dumitrescu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH V3 18/24] pipeline: introduce custom instructions",
        "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": "For better performance, the option to create custom instructions when\nthe program is translated and add them on-the-fly to the pipeline is\nnow provided. Multiple regular instructions can now be consolidated\ninto a single C function optimized by the C compiler directly.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\nV3:\n-created per pipeline instance instruction table\n\n lib/pipeline/rte_swx_pipeline.c          | 39 ++++++++++++++++++++++--\n lib/pipeline/rte_swx_pipeline_internal.h | 10 ++++++\n 2 files changed, 46 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex 0d02548137..9afe42ed25 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -6590,8 +6590,6 @@ instruction_config(struct rte_swx_pipeline *p,\n \treturn err;\n }\n \n-typedef void (*instr_exec_t)(struct rte_swx_pipeline *);\n-\n static instr_exec_t instruction_table[] = {\n \t[INSTR_RX] = instr_rx_exec,\n \t[INSTR_TX] = instr_tx_exec,\n@@ -6782,12 +6780,41 @@ static instr_exec_t instruction_table[] = {\n \t[INSTR_RETURN] = instr_return_exec,\n };\n \n+static int\n+instruction_table_build(struct rte_swx_pipeline *p)\n+{\n+\tp->instruction_table = calloc(RTE_SWX_PIPELINE_INSTRUCTION_TABLE_SIZE_MAX,\n+\t\t\t\t      sizeof(struct instr_exec_t *));\n+\tif (!p->instruction_table)\n+\t\treturn -EINVAL;\n+\n+\tmemcpy(p->instruction_table, instruction_table, sizeof(instruction_table));\n+\n+\treturn 0;\n+}\n+\n+static void\n+instruction_table_build_free(struct rte_swx_pipeline *p)\n+{\n+\tif (!p->instruction_table)\n+\t\treturn;\n+\n+\tfree(p->instruction_table);\n+\tp->instruction_table = NULL;\n+}\n+\n+static void\n+instruction_table_free(struct rte_swx_pipeline *p)\n+{\n+\tinstruction_table_build_free(p);\n+}\n+\n static inline void\n instr_exec(struct rte_swx_pipeline *p)\n {\n \tstruct thread *t = &p->threads[p->thread_id];\n \tstruct instruction *ip = t->ip;\n-\tinstr_exec_t instr = instruction_table[ip->type];\n+\tinstr_exec_t instr = p->instruction_table[ip->type];\n \n \tinstr(p);\n }\n@@ -8916,6 +8943,7 @@ rte_swx_pipeline_free(struct rte_swx_pipeline *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@@ -8985,6 +9013,10 @@ rte_swx_pipeline_build(struct rte_swx_pipeline *p)\n \tif (status)\n \t\tgoto error;\n \n+\tstatus = instruction_table_build(p);\n+\tif (status)\n+\t\tgoto error;\n+\n \tstatus = action_build(p);\n \tif (status)\n \t\tgoto error;\n@@ -9024,6 +9056,7 @@ rte_swx_pipeline_build(struct rte_swx_pipeline *p)\n \tselector_build_free(p);\n \ttable_build_free(p);\n \taction_build_free(p);\n+\tinstruction_table_build_free(p);\n \tmetadata_build_free(p);\n \theader_build_free(p);\n \textern_func_build_free(p);\ndiff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h\nindex 3578a10501..64625b40c6 100644\n--- a/lib/pipeline/rte_swx_pipeline_internal.h\n+++ b/lib/pipeline/rte_swx_pipeline_internal.h\n@@ -541,6 +541,9 @@ enum instruction_type {\n \t * Return from action\n \t */\n \tINSTR_RETURN,\n+\n+\t/* Start of custom instructions. */\n+\tINSTR_CUSTOM_0,\n };\n \n struct instr_operand {\n@@ -686,6 +689,8 @@ struct instruction_data {\n \tint invalid;\n };\n \n+typedef void (*instr_exec_t)(struct rte_swx_pipeline *);\n+\n /*\n  * Action.\n  */\n@@ -1363,6 +1368,10 @@ instr_operand_nbo(struct thread *t, const struct instr_operand *x)\n #define RTE_SWX_PIPELINE_THREADS_MAX 16\n #endif\n \n+#ifndef RTE_SWX_PIPELINE_INSTRUCTION_TABLE_SIZE_MAX\n+#define RTE_SWX_PIPELINE_INSTRUCTION_TABLE_SIZE_MAX 256\n+#endif\n+\n struct rte_swx_pipeline {\n \tstruct struct_type_tailq struct_types;\n \tstruct port_in_type_tailq port_in_types;\n@@ -1396,6 +1405,7 @@ struct rte_swx_pipeline {\n \tstruct metarray_runtime *metarray_runtime;\n \tstruct instruction *instructions;\n \tstruct instruction_data *instruction_data;\n+\tinstr_exec_t *instruction_table;\n \tstruct thread threads[RTE_SWX_PIPELINE_THREADS_MAX];\n \n \tuint32_t n_structs;\n",
    "prefixes": [
        "V3",
        "18/24"
    ]
}