get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 104718,
    "url": "https://patches.dpdk.org/api/patches/104718/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20211126235129.35781-1-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": "<20211126235129.35781-1-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211126235129.35781-1-cristian.dumitrescu@intel.com",
    "date": "2021-11-26T23:51:26",
    "name": "[1/4] pipeline: improve the drop instruction",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ca52808eb86a66d464d90dab6c36d9865a3870e6",
    "submitter": {
        "id": 19,
        "url": "https://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20211126235129.35781-1-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 20793,
            "url": "https://patches.dpdk.org/api/series/20793/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=20793",
            "date": "2021-11-26T23:51:26",
            "name": "[1/4] pipeline: improve the drop instruction",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/20793/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/104718/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/104718/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 0B78FA0C43;\n\tSat, 27 Nov 2021 00:51:34 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 826D34068A;\n\tSat, 27 Nov 2021 00:51:33 +0100 (CET)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by mails.dpdk.org (Postfix) with ESMTP id E304F4068A\n for <dev@dpdk.org>; Sat, 27 Nov 2021 00:51:31 +0100 (CET)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Nov 2021 15:51:30 -0800",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by orsmga008.jf.intel.com with ESMTP; 26 Nov 2021 15:51:29 -0800"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10180\"; a=\"299130306\"",
            "E=Sophos;i=\"5.87,267,1631602800\"; d=\"scan'208\";a=\"299130306\"",
            "E=Sophos;i=\"5.87,267,1631602800\"; d=\"scan'208\";a=\"510837552\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "yogesh.jangra@intel.com",
        "Subject": "[PATCH 1/4] pipeline: improve the drop instruction",
        "Date": "Fri, 26 Nov 2021 23:51:26 +0000",
        "Message-Id": "<20211126235129.35781-1-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "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": "The output port to be used as the drop port is now determined when the\ndrop instruction is executed as opposed to being statically determined\nat instruction translation time and hardcoded in the opcode.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Yogesh Jangra <yogesh.jangra@intel.com>:\n---\n lib/pipeline/rte_swx_pipeline.c          | 38 ++++++++++++++++++------\n lib/pipeline/rte_swx_pipeline_internal.h | 20 +++++++++++++\n 2 files changed, 49 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex 2145ca0a42..ff2fe964a5 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -1370,6 +1370,7 @@ instruction_is_tx(enum instruction_type type)\n \tswitch (type) {\n \tcase INSTR_TX:\n \tcase INSTR_TX_I:\n+\tcase INSTR_DROP:\n \t\treturn 1;\n \n \tdefault:\n@@ -1383,6 +1384,7 @@ instruction_does_tx(struct instruction *instr)\n \tswitch (instr->type) {\n \tcase INSTR_TX:\n \tcase INSTR_TX_I:\n+\tcase INSTR_DROP:\n \tcase INSTR_HDR_EMIT_TX:\n \tcase INSTR_HDR_EMIT2_TX:\n \tcase INSTR_HDR_EMIT3_TX:\n@@ -1591,7 +1593,7 @@ instr_tx_translate(struct rte_swx_pipeline *p,\n }\n \n static int\n-instr_drop_translate(struct rte_swx_pipeline *p,\n+instr_drop_translate(struct rte_swx_pipeline *p __rte_unused,\n \t\t     struct action *action __rte_unused,\n \t\t     char **tokens __rte_unused,\n \t\t     int n_tokens,\n@@ -1600,9 +1602,8 @@ instr_drop_translate(struct rte_swx_pipeline *p,\n {\n \tCHECK(n_tokens == 1, EINVAL);\n \n-\t/* TX_I. */\n-\tinstr->type = INSTR_TX_I;\n-\tinstr->io.io.val = p->n_ports_out - 1;\n+\t/* DROP. */\n+\tinstr->type = INSTR_DROP;\n \treturn 0;\n }\n \n@@ -1632,6 +1633,19 @@ instr_tx_i_exec(struct rte_swx_pipeline *p)\n \tinstr_rx_exec(p);\n }\n \n+static inline void\n+instr_drop_exec(struct rte_swx_pipeline *p)\n+{\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\n+\t__instr_drop_exec(p, t, ip);\n+\n+\t/* Thread. */\n+\tthread_ip_reset(p, t);\n+\tinstr_rx_exec(p);\n+}\n+\n /*\n  * extract.\n  */\n@@ -6199,7 +6213,7 @@ instr_pattern_emit_many_tx_search(struct instruction *instr,\n \tif (!i)\n \t\treturn 0;\n \n-\tif (!instruction_is_tx(instr[i].type))\n+\tif (instr[i].type != INSTR_TX)\n \t\treturn 0;\n \n \tif (data[i].n_users)\n@@ -6643,6 +6657,7 @@ static instr_exec_t instruction_table[] = {\n \t[INSTR_RX] = instr_rx_exec,\n \t[INSTR_TX] = instr_tx_exec,\n \t[INSTR_TX_I] = instr_tx_i_exec,\n+\t[INSTR_DROP] = instr_drop_exec,\n \n \t[INSTR_HDR_EXTRACT] = instr_hdr_extract_exec,\n \t[INSTR_HDR_EXTRACT2] = instr_hdr_extract2_exec,\n@@ -9901,6 +9916,7 @@ instr_type_to_name(struct instruction *instr)\n \n \tcase INSTR_TX: return \"INSTR_TX\";\n \tcase INSTR_TX_I: return \"INSTR_TX_I\";\n+\tcase INSTR_DROP: return \"INSTR_DROP\";\n \n \tcase INSTR_HDR_EXTRACT: return \"INSTR_HDR_EXTRACT\";\n \tcase INSTR_HDR_EXTRACT2: return \"INSTR_HDR_EXTRACT2\";\n@@ -10126,8 +10142,9 @@ instr_io_export(struct instruction *instr, FILE *f)\n \t\tinstr_type_to_name(instr));\n \n \t/* instr.io. */\n-\tfprintf(f,\n-\t\t\"\\t\\t.io = {\\n\");\n+\tif (n_io || n_io_imm || n_hdrs)\n+\t\tfprintf(f,\n+\t\t\t\"\\t\\t.io = {\\n\");\n \n \t/* instr.io.io. */\n \tif (n_io)\n@@ -10193,8 +10210,9 @@ instr_io_export(struct instruction *instr, FILE *f)\n \t}\n \n \t/* instr.io - closing curly brace. */\n-\tfprintf(f,\n-\t\t\"\\t\\t},\\n\");\n+\tif (n_io || n_io_imm || n_hdrs)\n+\t\tfprintf(f,\n+\t\t\t\"\\t\\t},\\n\");\n \n \t/* instr - closing curly brace. */\n \tfprintf(f,\n@@ -10767,6 +10785,7 @@ static instruction_export_t export_table[] = {\n \n \t[INSTR_TX] = instr_io_export,\n \t[INSTR_TX_I] = instr_io_export,\n+\t[INSTR_DROP] = instr_io_export,\n \n \t[INSTR_HDR_EXTRACT] = instr_io_export,\n \t[INSTR_HDR_EXTRACT2] = instr_io_export,\n@@ -10984,6 +11003,7 @@ instr_type_to_func(struct instruction *instr)\n \n \tcase INSTR_TX: return \"__instr_tx_exec\";\n \tcase INSTR_TX_I: return \"__instr_tx_i_exec\";\n+\tcase INSTR_DROP: return \"__instr_drop_exec\";\n \n \tcase INSTR_HDR_EXTRACT: return \"__instr_hdr_extract_exec\";\n \tcase INSTR_HDR_EXTRACT2: return \"__instr_hdr_extract2_exec\";\ndiff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h\nindex 1921fdcd78..2e86383e45 100644\n--- a/lib/pipeline/rte_swx_pipeline_internal.h\n+++ b/lib/pipeline/rte_swx_pipeline_internal.h\n@@ -225,6 +225,7 @@ enum instruction_type {\n \t */\n \tINSTR_TX,   /* port_out = M */\n \tINSTR_TX_I, /* port_out = I */\n+\tINSTR_DROP,\n \n \t/* extract h.header */\n \tINSTR_HDR_EXTRACT,\n@@ -1631,6 +1632,25 @@ __instr_tx_i_exec(struct rte_swx_pipeline *p, struct thread *t, const struct ins\n \tport->pkt_tx(port->obj, pkt);\n }\n \n+static inline void\n+__instr_drop_exec(struct rte_swx_pipeline *p,\n+\t\t  struct thread *t,\n+\t\t  const struct instruction *ip __rte_unused)\n+{\n+\tuint64_t port_id = p->n_ports_out - 1;\n+\tstruct port_out_runtime *port = &p->out[port_id];\n+\tstruct rte_swx_pkt *pkt = &t->pkt;\n+\n+\tTRACE(\"[Thread %2u]: drop 1 pkt\\n\",\n+\t      p->thread_id);\n+\n+\t/* Headers. */\n+\temit_handler(t);\n+\n+\t/* Packet. */\n+\tport->pkt_tx(port->obj, pkt);\n+}\n+\n /*\n  * extract.\n  */\n",
    "prefixes": [
        "1/4"
    ]
}