get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 137513,
    "url": "https://patches.dpdk.org/api/patches/137513/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20240229173154.121491-4-stephen@networkplumber.org/",
    "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": "<20240229173154.121491-4-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240229173154.121491-4-stephen@networkplumber.org",
    "date": "2024-02-29T17:31:08",
    "name": "[3/3] net/tap: compute TC handle correctly",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "83da45445947c41ae777714a541a94fe5c189a8f",
    "submitter": {
        "id": 27,
        "url": "https://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20240229173154.121491-4-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 31305,
            "url": "https://patches.dpdk.org/api/series/31305/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=31305",
            "date": "2024-02-29T17:31:05",
            "name": "TAP device fixes",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/31305/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/137513/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/137513/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 20A4543C3F;\n\tThu, 29 Feb 2024 18:32:25 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5E9CE42F91;\n\tThu, 29 Feb 2024 18:32:10 +0100 (CET)",
            "from mail-pg1-f174.google.com (mail-pg1-f174.google.com\n [209.85.215.174])\n by mails.dpdk.org (Postfix) with ESMTP id C711542F85\n for <dev@dpdk.org>; Thu, 29 Feb 2024 18:32:08 +0100 (CET)",
            "by mail-pg1-f174.google.com with SMTP id\n 41be03b00d2f7-5d8b887bb0cso962794a12.2\n for <dev@dpdk.org>; Thu, 29 Feb 2024 09:32:08 -0800 (PST)",
            "from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141])\n by smtp.gmail.com with ESMTPSA id\n r31-20020a63fc5f000000b005dc3fc53f19sm1584846pgk.7.2024.02.29.09.32.07\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 29 Feb 2024 09:32:07 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709227928;\n x=1709832728; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=+AeF2SCiSz//fc0HRFr/2OIbFohjhgN6psQREKMfvKU=;\n b=de/EO9/YC6N0oSHTJ9QEtsMErV4tPQrdZqg/XyFYJIYY/AO7AlRNlSTu5dkO2ewn/r\n AiNBZznAFzT9EMEAC+8/GRlzALMtAIkuZ9jXnnjk3fUr6Keyre61djswbIwopB/HbL+q\n RYqKrC2v4kcxySJV4AzOlKJM+X79/yxdZ2QZvQSyrrQJKIjaDzWjy20CYe2L3RuwOAK4\n FAKL6xjPBPjUU/3gIN+zs/os28w+HN1iVvryJS2rWg7dC2avd3MsqB/gcVWwQVUYNmxq\n ZsLxliFb4lQsmv7FS8tZb0zmhsnOQBLzQtdm8s37wMJ3Id60bxnXpz4T2L7x22akEV11\n lTiQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1709227928; x=1709832728;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=+AeF2SCiSz//fc0HRFr/2OIbFohjhgN6psQREKMfvKU=;\n b=P0iSLkjVAc72pjjiRz5Pmy8g4+BrH4I3MMkUXKzRCOdW0HgDRa7eksClEEMLiki48T\n KL3IEUSx43WZtELNFJKR5UOb5qFTJkGZnWByylaFyoXGxhp23fsLkHhuaefsNci9jhJc\n kjBLbfLntfCLTra/ubowz8AmPRTKagm8bdtXEXoGG53lLZiSWpoE2axHQ1md2zhFVTDJ\n Tt1BnlUaNSE85GJkF54uIJqy2C1I5/aPG26wPnh0fs2u3naibc398iqJ4wQ/Y3f6Qtq9\n Xmo3E70s985hTzwbmSvLLSHevAxLAzGg014ipgy/9NhT4SNfFTqEl06oDdPBugWMEbVN\n +JFg==",
        "X-Gm-Message-State": "AOJu0YxZv3wnTgcNZnAfoeHBhh9/a6Xl0DCSDegeTC4aQZrIyLKkn1Wa\n UcVShMGUdUeBUFP51KtxpAB2ztFvIfKDChAscoaQLA/Ih3+VZye5lLOxoAIXjknUm+7/6ef0vWn\n 0",
        "X-Google-Smtp-Source": "\n AGHT+IHTEbBrLI6NPYPA+Oj+PVTXSjwOfpK43mw+8LWX4o+5DOigr9dpq9ILfE6G8nXHTlJWpmfAFQ==",
        "X-Received": "by 2002:a05:6a00:3d43:b0:6e5:3abd:33bd with SMTP id\n lp3-20020a056a003d4300b006e53abd33bdmr3616230pfb.34.1709227927900;\n Thu, 29 Feb 2024 09:32:07 -0800 (PST)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>,\n Olga Shern <olgas@nvidia.com>, Keith Wiles <keith.wiles@intel.com>,\n Pascal Mazon <pascal.mazon@6wind.com>, Kevin Traynor <ktraynor@redhat.com>,\n Ferruh Yigit <ferruh.yigit@intel.com>",
        "Subject": "[PATCH 3/3] net/tap: compute TC handle correctly",
        "Date": "Thu, 29 Feb 2024 09:31:08 -0800",
        "Message-ID": "<20240229173154.121491-4-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240229173154.121491-1-stephen@networkplumber.org>",
        "References": "<20240229173154.121491-1-stephen@networkplumber.org>",
        "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": "The code to take a flow pointer and make a TC handle was incorrect\nand would always generate the same handle. This is because it was\nhashing the address of the union on the stack (which is invariant)\nrather than the contents of the union.\n\nThe following testpmd case would cause an error:\ntestpmd> flow create 0 ingress pattern eth src is 06:05:04:03:02:01 \\\n  / end actions queue index 2 / end\nFlow rule #0 created\ntestpmd> flow create 0 ingress pattern eth src is 06:05:04:03:02:02 \\\n  / end actions queue index 3 / end\ntap_nl_dump_ext_ack(): Filter already exists\ntap_flow_create(): Kernel refused TC filter rule creation (17): File exists\nport_flow_complain(): Caught PMD error type 2 (flow rule (handle)):\n  overlapping rules or Kernel too old for flower support: File exists\n\nThis fix does it in a more robust manner using size independent\ncode. It also initializes the hash seed so the same hash won't\nshow up every time and risk potential leakage of address to\nother places.\n\nBugzilla ID: 1382\nFixes: de96fe68ae95 (\"net/tap: add basic flow API patterns and actions\")\nFixes: a625ab89df11 (\"net/tap: fix build with GCC 11\")\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n drivers/net/tap/tap_flow.c | 23 ++++++++++++-----------\n 1 file changed, 12 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c\nindex 5b0fee906493..94f9b99cdaa6 100644\n--- a/drivers/net/tap/tap_flow.c\n+++ b/drivers/net/tap/tap_flow.c\n@@ -11,6 +11,7 @@\n \n #include <rte_byteorder.h>\n #include <rte_jhash.h>\n+#include <rte_random.h>\n #include <rte_malloc.h>\n #include <rte_eth_tap.h>\n #include <tap_flow.h>\n@@ -1297,9 +1298,7 @@ tap_flow_validate(struct rte_eth_dev *dev,\n  * In those rules, the handle (uint32_t) is the part that would identify\n  * specifically each rule.\n  *\n- * On 32-bit architectures, the handle can simply be the flow's pointer address.\n- * On 64-bit architectures, we rely on jhash(flow) to find a (sufficiently)\n- * unique handle.\n+ * Use jhash of the flow poitner to make a unique handle.\n  *\n  * @param[in, out] flow\n  *   The flow that needs its handle set.\n@@ -1309,16 +1308,18 @@ tap_flow_set_handle(struct rte_flow *flow)\n {\n \tunion {\n \t\tstruct rte_flow *flow;\n-\t\tconst void *key;\n-\t} tmp;\n-\tuint32_t handle = 0;\n+\t\tuint32_t words[sizeof(flow) / sizeof(uint32_t)];\n+\t} tmp = {\n+\t\t.flow = flow,\n+\t};\n+\tuint32_t handle;\n+\tstatic uint64_t hash_seed;\n \n-\ttmp.flow = flow;\n+\tif (hash_seed == 0)\n+\t\thash_seed = rte_rand();\n+\n+\thandle = rte_jhash_32b(tmp.words, sizeof(flow) / sizeof(uint32_t), hash_seed);\n \n-\tif (sizeof(flow) > 4)\n-\t\thandle = rte_jhash(tmp.key, sizeof(flow), 1);\n-\telse\n-\t\thandle = (uintptr_t)flow;\n \t/* must be at least 1 to avoid letting the kernel choose one for us */\n \tif (!handle)\n \t\thandle = 1;\n",
    "prefixes": [
        "3/3"
    ]
}