get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 98611,
    "url": "http://patchwork.dpdk.org/api/patches/98611/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210910123003.85448-6-cristian.dumitrescu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20210910123003.85448-6-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210910123003.85448-6-cristian.dumitrescu@intel.com",
    "date": "2021-09-10T12:29:45",
    "name": "[06/24] pipeline: create inline functions for emit instruction",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "69fd49b3728d3e162acef28c385a42b8c2e4a71e",
    "submitter": {
        "id": 19,
        "url": "http://patchwork.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210910123003.85448-6-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 18838,
            "url": "http://patchwork.dpdk.org/api/series/18838/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18838",
            "date": "2021-09-10T12:29:44",
            "name": "[01/24] pipeline: move data structures to internal header file",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/18838/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/98611/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/98611/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 D4D78A0547;\n\tFri, 10 Sep 2021 14:31:24 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id EC41740E6E;\n\tFri, 10 Sep 2021 14:30:31 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 4D3C840DF4\n for <dev@dpdk.org>; Fri, 10 Sep 2021 14:30:22 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 10 Sep 2021 05:30:10 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by orsmga001.jf.intel.com with ESMTP; 10 Sep 2021 05:30:09 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10102\"; a=\"243386260\"",
            "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"243386260\"",
            "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"514279715\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 10 Sep 2021 13:29:45 +0100",
        "Message-Id": "<20210910123003.85448-6-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20210910123003.85448-1-cristian.dumitrescu@intel.com>",
        "References": "<20210910123003.85448-1-cristian.dumitrescu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 06/24] pipeline: create inline functions for emit\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": "Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c          | 162 ++++++++-------------\n lib/pipeline/rte_swx_pipeline_internal.h | 170 +++++++++++++++++++++++\n 2 files changed, 228 insertions(+), 104 deletions(-)",
    "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex fd7e31b709..80c5fb94bb 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -1810,82 +1810,12 @@ instr_hdr_emit_translate(struct rte_swx_pipeline *p,\n }\n \n static inline void\n-__instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit);\n-\n-static inline void\n-__instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit)\n+instr_hdr_emit_exec(struct rte_swx_pipeline *p)\n {\n \tstruct thread *t = &p->threads[p->thread_id];\n \tstruct instruction *ip = t->ip;\n-\tuint64_t valid_headers = t->valid_headers;\n-\tuint32_t n_headers_out = t->n_headers_out;\n-\tstruct header_out_runtime *ho = &t->headers_out[n_headers_out - 1];\n-\tuint8_t *ho_ptr = NULL;\n-\tuint32_t ho_nbytes = 0, first = 1, i;\n-\n-\tfor (i = 0; i < n_emit; i++) {\n-\t\tuint32_t header_id = ip->io.hdr.header_id[i];\n-\t\tuint32_t struct_id = ip->io.hdr.struct_id[i];\n-\n-\t\tstruct header_runtime *hi = &t->headers[header_id];\n-\t\tuint8_t *hi_ptr0 = hi->ptr0;\n-\t\tuint32_t n_bytes = hi->n_bytes;\n-\n-\t\tuint8_t *hi_ptr = t->structs[struct_id];\n-\n-\t\tif (!MASK64_BIT_GET(valid_headers, header_id))\n-\t\t\tcontinue;\n-\n-\t\tTRACE(\"[Thread %2u]: emit header %u\\n\",\n-\t\t      p->thread_id,\n-\t\t      header_id);\n-\n-\t\t/* Headers. */\n-\t\tif (first) {\n-\t\t\tfirst = 0;\n-\n-\t\t\tif (!t->n_headers_out) {\n-\t\t\t\tho = &t->headers_out[0];\n-\n-\t\t\t\tho->ptr0 = hi_ptr0;\n-\t\t\t\tho->ptr = hi_ptr;\n-\n-\t\t\t\tho_ptr = hi_ptr;\n-\t\t\t\tho_nbytes = n_bytes;\n-\n-\t\t\t\tn_headers_out = 1;\n-\n-\t\t\t\tcontinue;\n-\t\t\t} else {\n-\t\t\t\tho_ptr = ho->ptr;\n-\t\t\t\tho_nbytes = ho->n_bytes;\n-\t\t\t}\n-\t\t}\n-\n-\t\tif (ho_ptr + ho_nbytes == hi_ptr) {\n-\t\t\tho_nbytes += n_bytes;\n-\t\t} else {\n-\t\t\tho->n_bytes = ho_nbytes;\n-\n-\t\t\tho++;\n-\t\t\tho->ptr0 = hi_ptr0;\n-\t\t\tho->ptr = hi_ptr;\n \n-\t\t\tho_ptr = hi_ptr;\n-\t\t\tho_nbytes = n_bytes;\n-\n-\t\t\tn_headers_out++;\n-\t\t}\n-\t}\n-\n-\tho->n_bytes = ho_nbytes;\n-\tt->n_headers_out = n_headers_out;\n-}\n-\n-static inline void\n-instr_hdr_emit_exec(struct rte_swx_pipeline *p)\n-{\n-\t__instr_hdr_emit_exec(p, 1);\n+\t__instr_hdr_emit_exec(p, t, ip);\n \n \t/* Thread. */\n \tthread_ip_inc(p);\n@@ -1894,81 +1824,105 @@ instr_hdr_emit_exec(struct rte_swx_pipeline *p)\n static inline void\n instr_hdr_emit_tx_exec(struct rte_swx_pipeline *p)\n {\n-\tTRACE(\"[Thread %2u] *** The next 2 instructions are fused. ***\\n\",\n-\t      p->thread_id);\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\n+\t__instr_hdr_emit_tx_exec(p, t, ip);\n \n-\t__instr_hdr_emit_exec(p, 1);\n-\tinstr_tx_exec(p);\n+\t/* Thread. */\n+\tthread_ip_reset(p, t);\n+\tinstr_rx_exec(p);\n }\n \n static inline void\n instr_hdr_emit2_tx_exec(struct rte_swx_pipeline *p)\n {\n-\tTRACE(\"[Thread %2u] *** The next 3 instructions are fused. ***\\n\",\n-\t      p->thread_id);\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n \n-\t__instr_hdr_emit_exec(p, 2);\n-\tinstr_tx_exec(p);\n+\t__instr_hdr_emit2_tx_exec(p, t, ip);\n+\n+\t/* Thread. */\n+\tthread_ip_reset(p, t);\n+\tinstr_rx_exec(p);\n }\n \n static inline void\n instr_hdr_emit3_tx_exec(struct rte_swx_pipeline *p)\n {\n-\tTRACE(\"[Thread %2u] *** The next 4 instructions are fused. ***\\n\",\n-\t      p->thread_id);\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\n+\t__instr_hdr_emit3_tx_exec(p, t, ip);\n \n-\t__instr_hdr_emit_exec(p, 3);\n-\tinstr_tx_exec(p);\n+\t/* Thread. */\n+\tthread_ip_reset(p, t);\n+\tinstr_rx_exec(p);\n }\n \n static inline void\n instr_hdr_emit4_tx_exec(struct rte_swx_pipeline *p)\n {\n-\tTRACE(\"[Thread %2u] *** The next 5 instructions are fused. ***\\n\",\n-\t      p->thread_id);\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\n+\t__instr_hdr_emit4_tx_exec(p, t, ip);\n \n-\t__instr_hdr_emit_exec(p, 4);\n-\tinstr_tx_exec(p);\n+\t/* Thread. */\n+\tthread_ip_reset(p, t);\n+\tinstr_rx_exec(p);\n }\n \n static inline void\n instr_hdr_emit5_tx_exec(struct rte_swx_pipeline *p)\n {\n-\tTRACE(\"[Thread %2u] *** The next 6 instructions are fused. ***\\n\",\n-\t      p->thread_id);\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n \n-\t__instr_hdr_emit_exec(p, 5);\n-\tinstr_tx_exec(p);\n+\t__instr_hdr_emit5_tx_exec(p, t, ip);\n+\n+\t/* Thread. */\n+\tthread_ip_reset(p, t);\n+\tinstr_rx_exec(p);\n }\n \n static inline void\n instr_hdr_emit6_tx_exec(struct rte_swx_pipeline *p)\n {\n-\tTRACE(\"[Thread %2u] *** The next 7 instructions are fused. ***\\n\",\n-\t      p->thread_id);\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\n+\t__instr_hdr_emit6_tx_exec(p, t, ip);\n \n-\t__instr_hdr_emit_exec(p, 6);\n-\tinstr_tx_exec(p);\n+\t/* Thread. */\n+\tthread_ip_reset(p, t);\n+\tinstr_rx_exec(p);\n }\n \n static inline void\n instr_hdr_emit7_tx_exec(struct rte_swx_pipeline *p)\n {\n-\tTRACE(\"[Thread %2u] *** The next 8 instructions are fused. ***\\n\",\n-\t      p->thread_id);\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\n+\t__instr_hdr_emit7_tx_exec(p, t, ip);\n \n-\t__instr_hdr_emit_exec(p, 7);\n-\tinstr_tx_exec(p);\n+\t/* Thread. */\n+\tthread_ip_reset(p, t);\n+\tinstr_rx_exec(p);\n }\n \n static inline void\n instr_hdr_emit8_tx_exec(struct rte_swx_pipeline *p)\n {\n-\tTRACE(\"[Thread %2u] *** The next 9 instructions are fused. ***\\n\",\n-\t      p->thread_id);\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\n+\t__instr_hdr_emit8_tx_exec(p, t, ip);\n \n-\t__instr_hdr_emit_exec(p, 8);\n-\tinstr_tx_exec(p);\n+\t/* Thread. */\n+\tthread_ip_reset(p, t);\n+\tinstr_rx_exec(p);\n }\n \n /*\ndiff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h\nindex 1519bcc305..8b37a9812e 100644\n--- a/lib/pipeline/rte_swx_pipeline_internal.h\n+++ b/lib/pipeline/rte_swx_pipeline_internal.h\n@@ -1758,4 +1758,174 @@ __instr_hdr_lookahead_exec(struct rte_swx_pipeline *p __rte_unused,\n \tt->valid_headers = MASK64_BIT_SET(valid_headers, header_id);\n }\n \n+/*\n+ * emit.\n+ */\n+static inline void\n+__instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,\n+\t\t\t   struct thread *t,\n+\t\t\t   const struct instruction *ip,\n+\t\t\t   uint32_t n_emit)\n+{\n+\tuint64_t valid_headers = t->valid_headers;\n+\tuint32_t n_headers_out = t->n_headers_out;\n+\tstruct header_out_runtime *ho = &t->headers_out[n_headers_out - 1];\n+\tuint8_t *ho_ptr = NULL;\n+\tuint32_t ho_nbytes = 0, first = 1, i;\n+\n+\tfor (i = 0; i < n_emit; i++) {\n+\t\tuint32_t header_id = ip->io.hdr.header_id[i];\n+\t\tuint32_t struct_id = ip->io.hdr.struct_id[i];\n+\n+\t\tstruct header_runtime *hi = &t->headers[header_id];\n+\t\tuint8_t *hi_ptr0 = hi->ptr0;\n+\t\tuint32_t n_bytes = hi->n_bytes;\n+\n+\t\tuint8_t *hi_ptr = t->structs[struct_id];\n+\n+\t\tif (!MASK64_BIT_GET(valid_headers, header_id))\n+\t\t\tcontinue;\n+\n+\t\tTRACE(\"[Thread %2u]: emit header %u\\n\",\n+\t\t      p->thread_id,\n+\t\t      header_id);\n+\n+\t\t/* Headers. */\n+\t\tif (first) {\n+\t\t\tfirst = 0;\n+\n+\t\t\tif (!t->n_headers_out) {\n+\t\t\t\tho = &t->headers_out[0];\n+\n+\t\t\t\tho->ptr0 = hi_ptr0;\n+\t\t\t\tho->ptr = hi_ptr;\n+\n+\t\t\t\tho_ptr = hi_ptr;\n+\t\t\t\tho_nbytes = n_bytes;\n+\n+\t\t\t\tn_headers_out = 1;\n+\n+\t\t\t\tcontinue;\n+\t\t\t} else {\n+\t\t\t\tho_ptr = ho->ptr;\n+\t\t\t\tho_nbytes = ho->n_bytes;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (ho_ptr + ho_nbytes == hi_ptr) {\n+\t\t\tho_nbytes += n_bytes;\n+\t\t} else {\n+\t\t\tho->n_bytes = ho_nbytes;\n+\n+\t\t\tho++;\n+\t\t\tho->ptr0 = hi_ptr0;\n+\t\t\tho->ptr = hi_ptr;\n+\n+\t\t\tho_ptr = hi_ptr;\n+\t\t\tho_nbytes = n_bytes;\n+\n+\t\t\tn_headers_out++;\n+\t\t}\n+\t}\n+\n+\tho->n_bytes = ho_nbytes;\n+\tt->n_headers_out = n_headers_out;\n+}\n+\n+static inline void\n+__instr_hdr_emit_exec(struct rte_swx_pipeline *p,\n+\t\t      struct thread *t,\n+\t\t      const struct instruction *ip)\n+{\n+\t__instr_hdr_emit_many_exec(p, t, ip, 1);\n+}\n+\n+static inline void\n+__instr_hdr_emit_tx_exec(struct rte_swx_pipeline *p,\n+\t\t\t struct thread *t,\n+\t\t\t const struct instruction *ip)\n+{\n+\tTRACE(\"[Thread %2u] *** The next 2 instructions are fused. ***\\n\", p->thread_id);\n+\n+\t__instr_hdr_emit_many_exec(p, t, ip, 1);\n+\t__instr_tx_exec(p, t, ip);\n+}\n+\n+static inline void\n+__instr_hdr_emit2_tx_exec(struct rte_swx_pipeline *p,\n+\t\t\t  struct thread *t,\n+\t\t\t  const struct instruction *ip)\n+{\n+\tTRACE(\"[Thread %2u] *** The next 3 instructions are fused. ***\\n\", p->thread_id);\n+\n+\t__instr_hdr_emit_many_exec(p, t, ip, 2);\n+\t__instr_tx_exec(p, t, ip);\n+}\n+\n+static inline void\n+__instr_hdr_emit3_tx_exec(struct rte_swx_pipeline *p,\n+\t\t\t  struct thread *t,\n+\t\t\t  const struct instruction *ip)\n+{\n+\tTRACE(\"[Thread %2u] *** The next 4 instructions are fused. ***\\n\", p->thread_id);\n+\n+\t__instr_hdr_emit_many_exec(p, t, ip, 3);\n+\t__instr_tx_exec(p, t, ip);\n+}\n+\n+static inline void\n+__instr_hdr_emit4_tx_exec(struct rte_swx_pipeline *p,\n+\t\t\t  struct thread *t,\n+\t\t\t  const struct instruction *ip)\n+{\n+\tTRACE(\"[Thread %2u] *** The next 5 instructions are fused. ***\\n\", p->thread_id);\n+\n+\t__instr_hdr_emit_many_exec(p, t, ip, 4);\n+\t__instr_tx_exec(p, t, ip);\n+}\n+\n+static inline void\n+__instr_hdr_emit5_tx_exec(struct rte_swx_pipeline *p,\n+\t\t\t  struct thread *t,\n+\t\t\t  const struct instruction *ip)\n+{\n+\tTRACE(\"[Thread %2u] *** The next 6 instructions are fused. ***\\n\", p->thread_id);\n+\n+\t__instr_hdr_emit_many_exec(p, t, ip, 5);\n+\t__instr_tx_exec(p, t, ip);\n+}\n+\n+static inline void\n+__instr_hdr_emit6_tx_exec(struct rte_swx_pipeline *p,\n+\t\t\t  struct thread *t,\n+\t\t\t  const struct instruction *ip)\n+{\n+\tTRACE(\"[Thread %2u] *** The next 7 instructions are fused. ***\\n\", p->thread_id);\n+\n+\t__instr_hdr_emit_many_exec(p, t, ip, 6);\n+\t__instr_tx_exec(p, t, ip);\n+}\n+\n+static inline void\n+__instr_hdr_emit7_tx_exec(struct rte_swx_pipeline *p,\n+\t\t\t  struct thread *t,\n+\t\t\t  const struct instruction *ip)\n+{\n+\tTRACE(\"[Thread %2u] *** The next 8 instructions are fused. ***\\n\", p->thread_id);\n+\n+\t__instr_hdr_emit_many_exec(p, t, ip, 7);\n+\t__instr_tx_exec(p, t, ip);\n+}\n+\n+static inline void\n+__instr_hdr_emit8_tx_exec(struct rte_swx_pipeline *p,\n+\t\t\t  struct thread *t,\n+\t\t\t  const struct instruction *ip)\n+{\n+\tTRACE(\"[Thread %2u] *** The next 9 instructions are fused. ***\\n\", p->thread_id);\n+\n+\t__instr_hdr_emit_many_exec(p, t, ip, 8);\n+\t__instr_tx_exec(p, t, ip);\n+}\n+\n #endif\n",
    "prefixes": [
        "06/24"
    ]
}