Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/96338/?format=api
http://patches.dpdk.org/api/patches/96338/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210727174340.2125-3-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-3-cristian.dumitrescu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210727174340.2125-3-cristian.dumitrescu@intel.com", "date": "2021-07-27T17:43:38", "name": "[V2,3/5] pipeline: add variable size headers extract instruction", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "73311b6cc4e98aa02779251ea24ab1c79f4ae9e3", "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-3-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/96338/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/96338/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 AC325A0C55;\n\tTue, 27 Jul 2021 19:44:10 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9ED0A41124;\n\tTue, 27 Jul 2021 19:43:54 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id C67F2410F2\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:43 -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:42 -0700" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10058\"; a=\"199677799\"", "E=Sophos;i=\"5.84,274,1620716400\"; d=\"scan'208\";a=\"199677799\"", "E=Sophos;i=\"5.84,274,1620716400\"; d=\"scan'208\";a=\"517040399\"" ], "X-ExtLoop1": "1", "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>", "To": "dev@dpdk.org", "Date": "Tue, 27 Jul 2021 18:43:38 +0100", "Message-Id": "<20210727174340.2125-3-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 3/5] pipeline: add variable size headers\n extract 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 a mechanism to extract variable size headers through a special\nflavor of the extract instruction. The length of the last struct field\nwhich has variable size is passed as argument to the instruction.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c | 75 ++++++++++++++++++++++++++++++---\n 1 file changed, 69 insertions(+), 6 deletions(-)", "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex 1a8259ffee..d87fe77d91 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -303,6 +303,9 @@ enum instruction_type {\n \tINSTR_HDR_EXTRACT7,\n \tINSTR_HDR_EXTRACT8,\n \n+\t/* extract h.header m.last_field_size */\n+\tINSTR_HDR_EXTRACT_M,\n+\n \t/* emit h.header */\n \tINSTR_HDR_EMIT,\n \tINSTR_HDR_EMIT_TX,\n@@ -3088,16 +3091,35 @@ instr_hdr_extract_translate(struct rte_swx_pipeline *p,\n \tstruct header *h;\n \n \tCHECK(!action, EINVAL);\n-\tCHECK(n_tokens == 2, EINVAL);\n+\tCHECK((n_tokens == 2) || (n_tokens == 3), 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_EXTRACT;\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] = h->st->n_bits / 8;\n+\tif (n_tokens == 2) {\n+\t\tCHECK(!h->st->var_size, EINVAL);\n+\n+\t\tinstr->type = INSTR_HDR_EXTRACT;\n+\t\tinstr->io.hdr.header_id[0] = h->id;\n+\t\tinstr->io.hdr.struct_id[0] = h->struct_id;\n+\t\tinstr->io.hdr.n_bytes[0] = h->st->n_bits / 8;\n+\t} else {\n+\t\tstruct field *mf;\n+\n+\t\tCHECK(h->st->var_size, EINVAL);\n+\n+\t\tmf = metadata_field_parse(p, tokens[2]);\n+\t\tCHECK(mf, EINVAL);\n+\t\tCHECK(!mf->var_size, EINVAL);\n+\n+\t\tinstr->type = INSTR_HDR_EXTRACT_M;\n+\t\tinstr->io.io.offset = mf->offset / 8;\n+\t\tinstr->io.io.n_bits = mf->n_bits;\n+\t\tinstr->io.hdr.header_id[0] = h->id;\n+\t\tinstr->io.hdr.struct_id[0] = h->struct_id;\n+\t\tinstr->io.hdr.n_bytes[0] = h->st->n_bits_min / 8;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -3237,6 +3259,46 @@ instr_hdr_extract8_exec(struct rte_swx_pipeline *p)\n \tthread_ip_inc(p);\n }\n \n+static inline void\n+instr_hdr_extract_m_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+\tuint32_t offset = t->pkt.offset;\n+\tuint32_t length = t->pkt.length;\n+\n+\tuint32_t n_bytes_last = METADATA_READ(t, ip->io.io.offset, ip->io.io.n_bits);\n+\tuint32_t header_id = ip->io.hdr.header_id[0];\n+\tuint32_t struct_id = ip->io.hdr.struct_id[0];\n+\tuint32_t n_bytes = ip->io.hdr.n_bytes[0];\n+\n+\tstruct header_runtime *h = &t->headers[header_id];\n+\n+\tTRACE(\"[Thread %2u]: extract header %u (%u + %u bytes)\\n\",\n+\t p->thread_id,\n+\t header_id,\n+\t n_bytes,\n+\t n_bytes_last);\n+\n+\tn_bytes += n_bytes_last;\n+\n+\t/* Headers. */\n+\tt->structs[struct_id] = ptr;\n+\tt->valid_headers = MASK64_BIT_SET(valid_headers, header_id);\n+\th->n_bytes = n_bytes;\n+\n+\t/* Packet. */\n+\tt->pkt.offset = offset + n_bytes;\n+\tt->pkt.length = length - n_bytes;\n+\tt->ptr = ptr + n_bytes;\n+\n+\t/* Thread. */\n+\tthread_ip_inc(p);\n+}\n+\n /*\n * emit.\n */\n@@ -8842,6 +8904,7 @@ static instr_exec_t instruction_table[] = {\n \t[INSTR_HDR_EXTRACT6] = instr_hdr_extract6_exec,\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 \n \t[INSTR_HDR_EMIT] = instr_hdr_emit_exec,\n \t[INSTR_HDR_EMIT_TX] = instr_hdr_emit_tx_exec,\n", "prefixes": [ "V2", "3/5" ] }{ "id": 96338, "url": "