get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 136798,
    "url": "https://patches.dpdk.org/api/patches/136798/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20240214205836.1561803-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": "<20240214205836.1561803-1-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240214205836.1561803-1-cristian.dumitrescu@intel.com",
    "date": "2024-02-14T20:58:36",
    "name": "[V2] pipeline: remove limitation on number of input ports",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "414574c870a81aaae458a8ec06e8807f2c38e940",
    "submitter": {
        "id": 19,
        "url": "https://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20240214205836.1561803-1-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 31111,
            "url": "https://patches.dpdk.org/api/series/31111/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=31111",
            "date": "2024-02-14T20:58:36",
            "name": "[V2] pipeline: remove limitation on number of input ports",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/31111/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/136798/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/136798/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 0E0E543B0E;\n\tWed, 14 Feb 2024 21:58:41 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id CFDA642E10;\n\tWed, 14 Feb 2024 21:58:40 +0100 (CET)",
            "from mgamail.intel.com (mgamail.intel.com [192.198.163.11])\n by mails.dpdk.org (Postfix) with ESMTP id 1DF0F400D5\n for <dev@dpdk.org>; Wed, 14 Feb 2024 21:58:38 +0100 (CET)",
            "from orviesa007.jf.intel.com ([10.64.159.147])\n by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 14 Feb 2024 12:58:38 -0800",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.184])\n by orviesa007.jf.intel.com with ESMTP; 14 Feb 2024 12:58:38 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1707944319; x=1739480319;\n h=from:to:subject:date:message-id:in-reply-to:references:\n mime-version:content-transfer-encoding;\n bh=XSB7uNbRxVttOPxhGUeF8PBxbYGgV5tjPuMGk3SKp0o=;\n b=LsfbG8mVIvV2LQfD3YQfxQ4qEjJOAohjLL7WXGEqxEezqu95UjNo7v8T\n 91/Iq7GU89cd/LFawPtgiLZH6XJ6toAHrigwQ30UwsSsvtOgZBm8M7Qod\n HE05yrRaq4EuVloPN3KoRQ4olRiiJKkNJI7wDOnDc8RbZExV8TXaQwCrc\n Mslkfy8ln6txh5JKUDmgoqOzyhW1UHTnPIHN3WwpahxwRq0l1L9Y2eM3G\n PnKiLKZoQqPNcf5WYcvPW7fAkgPYPbkWrVKSJQpGLyNTNOL3BgMWA/DY0\n FADlk8P3Us7cDJBFRC4sCUjNy8UYwZmkwk+0TUOPuSqVtx7SRiAUBbuZb Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10984\"; a=\"12643060\"",
            "E=Sophos;i=\"6.06,160,1705392000\"; d=\"scan'208\";a=\"12643060\"",
            "E=Sophos;i=\"6.06,160,1705392000\";\n   d=\"scan'208\";a=\"3633908\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Subject": "[PATCH V2] pipeline: remove limitation on number of input ports",
        "Date": "Wed, 14 Feb 2024 20:58:36 +0000",
        "Message-Id": "<20240214205836.1561803-1-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20240214205151.1559571-1-cristian.dumitrescu@intel.com>",
        "References": "<20240214205151.1559571-1-cristian.dumitrescu@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "Removed the requirement that the number of pipeline input ports be a\npower of 2, which is problematic for many real life use-cases. Also\nadding checks for the output port validity used for sending the\ncurrent packet.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c          |  1 -\n lib/pipeline/rte_swx_pipeline_internal.h | 38 ++++++++++++++++++++----\n 2 files changed, 33 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex 147c1c2ad4..6ba86bee1f 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -340,7 +340,6 @@ port_in_build(struct rte_swx_pipeline *p)\n \tuint32_t i;\n \n \tCHECK(p->n_ports_in, EINVAL);\n-\tCHECK(rte_is_power_of_2(p->n_ports_in), EINVAL);\n \n \tfor (i = 0; i < p->n_ports_in; i++)\n \t\tCHECK(port_in_find(p, i), EINVAL);\ndiff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h\nindex f5a64e0fe1..8b3e79e8fe 100644\n--- a/lib/pipeline/rte_swx_pipeline_internal.h\n+++ b/lib/pipeline/rte_swx_pipeline_internal.h\n@@ -1612,7 +1612,13 @@ struct rte_swx_pipeline {\n static inline void\n pipeline_port_inc(struct rte_swx_pipeline *p)\n {\n-\tp->port_id = (p->port_id + 1) & (p->n_ports_in - 1);\n+\tuint32_t port_id = p->port_id;\n+\n+\tport_id++;\n+\tif (port_id == p->n_ports_in)\n+\t\tport_id = 0;\n+\n+\tp->port_id = port_id;\n }\n \n static inline void\n@@ -1825,9 +1831,9 @@ mirroring_handler(struct rte_swx_pipeline *p, struct thread *t, struct rte_swx_p\n static inline void\n __instr_tx_exec(struct rte_swx_pipeline *p, struct thread *t, const struct instruction *ip)\n {\n-\tuint64_t port_id = METADATA_READ(t, ip->io.io.offset, ip->io.io.n_bits);\n-\tstruct port_out_runtime *port = &p->out[port_id];\n \tstruct rte_swx_pkt *pkt = &t->pkt;\n+\tstruct port_out_runtime *port;\n+\tuint64_t port_id;\n \n \t/* Recirculation: keep the current packet. */\n \tif (t->recirculate) {\n@@ -1843,6 +1849,15 @@ __instr_tx_exec(struct rte_swx_pipeline *p, struct thread *t, const struct instr\n \t\treturn;\n \t}\n \n+\t/* If the output port ID is invalid, then set it to the drop output port that has been set\n+\t * up internally by the pipeline for this purpose.\n+\t */\n+\tport_id = METADATA_READ(t, ip->io.io.offset, ip->io.io.n_bits);\n+\tif (port_id >= p->n_ports_out)\n+\t\tport_id = p->n_ports_out - 1;\n+\n+\tport = &p->out[port_id];\n+\n \tTRACE(\"[Thread %2u]: tx 1 pkt to port %u\\n\",\n \t      p->thread_id,\n \t      (uint32_t)port_id);\n@@ -1858,9 +1873,9 @@ __instr_tx_exec(struct rte_swx_pipeline *p, struct thread *t, const struct instr\n static inline void\n __instr_tx_i_exec(struct rte_swx_pipeline *p, struct thread *t, const struct instruction *ip)\n {\n-\tuint64_t port_id = ip->io.io.val;\n-\tstruct port_out_runtime *port = &p->out[port_id];\n \tstruct rte_swx_pkt *pkt = &t->pkt;\n+\tstruct port_out_runtime *port;\n+\tuint64_t port_id;\n \n \t/* Recirculation: keep the current packet. */\n \tif (t->recirculate) {\n@@ -1876,6 +1891,19 @@ __instr_tx_i_exec(struct rte_swx_pipeline *p, struct thread *t, const struct ins\n \t\treturn;\n \t}\n \n+\t/* If the output port ID is invalid, then set it to the drop output port that has been set\n+\t * up internally by the pipeline for this purpose.\n+\t *\n+\t * This test cannot be done earlier at instruction translation time, even though the output\n+\t * port ID is an immediate value, as the number of output ports is only known later at the\n+\t * pipeline build time.\n+\t */\n+\tport_id = ip->io.io.val;\n+\tif (port_id >= p->n_ports_out)\n+\t\tport_id = p->n_ports_out - 1;\n+\n+\tport = &p->out[port_id];\n+\n \tTRACE(\"[Thread %2u]: tx (i) 1 pkt to port %u\\n\",\n \t      p->thread_id,\n \t      (uint32_t)port_id);\n",
    "prefixes": [
        "V2"
    ]
}