get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 96337,
    "url": "http://patches.dpdk.org/api/patches/96337/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210727174340.2125-4-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": "<20210727174340.2125-4-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210727174340.2125-4-cristian.dumitrescu@intel.com",
    "date": "2021-07-27T17:43:39",
    "name": "[V2,4/5] pipeline: add header look-ahead instruction",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "0185337374d378c37055a3fd65d75a363adac73a",
    "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/20210727174340.2125-4-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 18023,
            "url": "http://patches.dpdk.org/api/series/18023/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18023",
            "date": "2021-07-27T17:43:37",
            "name": "[V2,1/5] pipeline: prepare for variable size headers",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/18023/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/96337/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/96337/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 40144A0C55;\n\tTue, 27 Jul 2021 19:44:04 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 8A13B4111C;\n\tTue, 27 Jul 2021 19:43:53 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id BAA0B410F0\n for <dev@dpdk.org>; Tue, 27 Jul 2021 19:43:49 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Jul 2021 10:43:44 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by fmsmga002.fm.intel.com with ESMTP; 27 Jul 2021 10:43:43 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10058\"; a=\"199677813\"",
            "E=Sophos;i=\"5.84,274,1620716400\"; d=\"scan'208\";a=\"199677813\"",
            "E=Sophos;i=\"5.84,274,1620716400\"; d=\"scan'208\";a=\"517040409\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 27 Jul 2021 18:43:39 +0100",
        "Message-Id": "<20210727174340.2125-4-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20210727174340.2125-1-cristian.dumitrescu@intel.com>",
        "References": "<20210727163609.97769-1-cristian.dumitrescu@intel.com>\n <20210727174340.2125-1-cristian.dumitrescu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH V2 4/5] pipeline: add header look-ahead\n instruction",
        "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": "Added look-ahead instruction to read a header from the input packet\nwithout advancing the extraction pointer. This is typically used in\ncorrelation with the special extract instruction to extract variable\nsize headers from the input packet: the first few header fields are\nread without advancing the extraction pointer, just enough to detect\nthe actual length of the header (e.g. IPv4 IHL field); then the full\nheader is extracted.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c | 61 +++++++++++++++++++++++++++++++++\n 1 file changed, 61 insertions(+)",
    "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex d87fe77d91..13028bcc6a 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -306,6 +306,9 @@ enum instruction_type {\n \t/* extract h.header m.last_field_size */\n \tINSTR_HDR_EXTRACT_M,\n \n+\t/* lookahead h.header */\n+\tINSTR_HDR_LOOKAHEAD,\n+\n \t/* emit h.header */\n \tINSTR_HDR_EMIT,\n \tINSTR_HDR_EMIT_TX,\n@@ -3123,6 +3126,31 @@ instr_hdr_extract_translate(struct rte_swx_pipeline *p,\n \treturn 0;\n }\n \n+static int\n+instr_hdr_lookahead_translate(struct rte_swx_pipeline *p,\n+\t\t\t      struct action *action,\n+\t\t\t      char **tokens,\n+\t\t\t      int n_tokens,\n+\t\t\t      struct instruction *instr,\n+\t\t\t      struct instruction_data *data __rte_unused)\n+{\n+\tstruct header *h;\n+\n+\tCHECK(!action, EINVAL);\n+\tCHECK(n_tokens == 2, EINVAL);\n+\n+\th = header_parse(p, tokens[1]);\n+\tCHECK(h, EINVAL);\n+\tCHECK(!h->st->var_size, EINVAL);\n+\n+\tinstr->type = INSTR_HDR_LOOKAHEAD;\n+\tinstr->io.hdr.header_id[0] = h->id;\n+\tinstr->io.hdr.struct_id[0] = h->struct_id;\n+\tinstr->io.hdr.n_bytes[0] = 0; /* Unused. */\n+\n+\treturn 0;\n+}\n+\n static inline void\n __instr_hdr_extract_exec(struct rte_swx_pipeline *p, uint32_t n_extract);\n \n@@ -3299,6 +3327,30 @@ instr_hdr_extract_m_exec(struct rte_swx_pipeline *p)\n \tthread_ip_inc(p);\n }\n \n+static inline void\n+instr_hdr_lookahead_exec(struct rte_swx_pipeline *p)\n+{\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\n+\tuint64_t valid_headers = t->valid_headers;\n+\tuint8_t *ptr = t->ptr;\n+\n+\tuint32_t header_id = ip->io.hdr.header_id[0];\n+\tuint32_t struct_id = ip->io.hdr.struct_id[0];\n+\n+\tTRACE(\"[Thread %2u]: lookahead header %u\\n\",\n+\t      p->thread_id,\n+\t      header_id);\n+\n+\t/* Headers. */\n+\tt->structs[struct_id] = ptr;\n+\tt->valid_headers = MASK64_BIT_SET(valid_headers, header_id);\n+\n+\t/* Thread. */\n+\tthread_ip_inc(p);\n+}\n+\n /*\n  * emit.\n  */\n@@ -7916,6 +7968,14 @@ instr_translate(struct rte_swx_pipeline *p,\n \t\t\t\t\t\t   instr,\n \t\t\t\t\t\t   data);\n \n+\tif (!strcmp(tokens[tpos], \"lookahead\"))\n+\t\treturn instr_hdr_lookahead_translate(p,\n+\t\t\t\t\t\t     action,\n+\t\t\t\t\t\t     &tokens[tpos],\n+\t\t\t\t\t\t     n_tokens - tpos,\n+\t\t\t\t\t\t     instr,\n+\t\t\t\t\t\t     data);\n+\n \tif (!strcmp(tokens[tpos], \"emit\"))\n \t\treturn instr_hdr_emit_translate(p,\n \t\t\t\t\t\taction,\n@@ -8905,6 +8965,7 @@ static instr_exec_t instruction_table[] = {\n \t[INSTR_HDR_EXTRACT7] = instr_hdr_extract7_exec,\n \t[INSTR_HDR_EXTRACT8] = instr_hdr_extract8_exec,\n \t[INSTR_HDR_EXTRACT_M] = instr_hdr_extract_m_exec,\n+\t[INSTR_HDR_LOOKAHEAD] = instr_hdr_lookahead_exec,\n \n \t[INSTR_HDR_EMIT] = instr_hdr_emit_exec,\n \t[INSTR_HDR_EMIT_TX] = instr_hdr_emit_tx_exec,\n",
    "prefixes": [
        "V2",
        "4/5"
    ]
}