get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 139101,
    "url": "http://patches.dpdk.org/api/patches/139101/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240404162422.61510-2-stephen@networkplumber.org/",
    "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": "<20240404162422.61510-2-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240404162422.61510-2-stephen@networkplumber.org",
    "date": "2024-04-04T16:22:13",
    "name": "[v3,1/2] eal: add functions to generate uuid values",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "fdffae005248df4779ef977716c0684a732270c0",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "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/20240404162422.61510-2-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 31679,
            "url": "http://patches.dpdk.org/api/series/31679/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31679",
            "date": "2024-04-04T16:22:12",
            "name": "uuid: add generate functions and tests",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/31679/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/139101/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/139101/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 219C043DFB;\n\tThu,  4 Apr 2024 18:24:46 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6B154406B6;\n\tThu,  4 Apr 2024 18:24:41 +0200 (CEST)",
            "from mail-oa1-f45.google.com (mail-oa1-f45.google.com\n [209.85.160.45]) by mails.dpdk.org (Postfix) with ESMTP id 0A0D6402BC\n for <dev@dpdk.org>; Thu,  4 Apr 2024 18:24:39 +0200 (CEST)",
            "by mail-oa1-f45.google.com with SMTP id\n 586e51a60fabf-22a1e72f683so627664fac.0\n for <dev@dpdk.org>; Thu, 04 Apr 2024 09:24:38 -0700 (PDT)",
            "from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])\n by smtp.gmail.com with ESMTPSA id\n k196-20020a633dcd000000b005ceeeea1816sm13784188pga.77.2024.04.04.09.24.37\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 04 Apr 2024 09:24:37 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1712247878;\n x=1712852678; 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=lEyohggaCjIiTNrDHIAb6B0hEkoz2H9eJQ/85fF3I1s=;\n b=SYmBFDzqwU7E3brJcoHO/fUitppw47A3NPakoNo2S1FCfAWFu0CuZqFGJUH/LlZItQ\n CbuMproSz+uggYd6Px2fv1ilz7a9GXmw4AAYdQVSj0ubNREk6ODhr3hvvlZfTp9Mu70A\n 89P4fKWKWHdKxo/HAHCzsib+B5ClEh7pPKD0GAbMamLiT82y0YlNBIbG95Zt/jGgu5QD\n NHDG6NJnkKmYD0688XMV0bXNIccO21U9vz8fh9mBrYaSJ3sP+GrnJ+ESIB5ZhsYxlNM0\n 5ONidLAlpojHf1Jqn8VCfpA9MRPN5FdlXe/daHYcnrIjzsQwXjRc9qGjZbVVC9Q/YPWc\n 677A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1712247878; x=1712852678;\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=lEyohggaCjIiTNrDHIAb6B0hEkoz2H9eJQ/85fF3I1s=;\n b=BsH2Qrv8ZW1bvAwEtMc1hk9VoD1YKt8bxCcAQ8wZyyLT01kMB6o9fWJYIrlu4eD/2G\n 6QJHz9hWJRH4abegoRvJq6OHurMgOe37VC+5ERQ2tVafag+17kLCIxnys82vXxXX4Dob\n YZcz/bqCQ5bmOdTWpgdEew6WB8LIM3B27S/OAhmyDNt0Za+sTLxtpt1SXKmqIJcTeyT+\n g3wsIutylmq6wPyy3UC+9Haz0QvdIsZOJVFBE/TaC670N1Ha66BnTF0XfyATBzEaFlcK\n aSI+22FJtv/CbLrRZF0/RTTtx2Ok++Lc+Wa90I8uaT7O/2JCy8xJIg6vtIGk6hjKQ0WN\n lBNQ==",
        "X-Gm-Message-State": "AOJu0Yy4WaprJZrBgcqfQWN1ejut5PnPfeffFKJAkI4Qbwom72DNq0iG\n yk4ad+DwvRnjAI2X6s0L2AOGQYvedUR8Qxw8YfosGSD2Jh70b/pARdfMihBrAelSeHYPeHCG0nD\n /XG0=",
        "X-Google-Smtp-Source": "\n AGHT+IGUQNvRwkQACVXQvDRJZDfDpupAwWSZVJ/qOYuze8H6vouo2Mad2Nt+1enS1pEN+YV4qouqhQ==",
        "X-Received": "by 2002:a05:6870:fb9e:b0:220:a0b0:6d4a with SMTP id\n kv30-20020a056870fb9e00b00220a0b06d4amr2966112oab.57.1712247878262;\n Thu, 04 Apr 2024 09:24:38 -0700 (PDT)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>",
        "Subject": "[PATCH v3 1/2] eal: add functions to generate uuid values",
        "Date": "Thu,  4 Apr 2024 09:22:13 -0700",
        "Message-ID": "<20240404162422.61510-2-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240404162422.61510-1-stephen@networkplumber.org>",
        "References": "<20240403163432.437275-1-stephen@networkplumber.org>\n <20240404162422.61510-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": "Useful to be able to generate uuid values for tests or\nfor interaction with other subsystems as magic cookie.\nNaming and overall algorithm come from libuuid which is used\nby permission of original author.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n lib/eal/common/eal_common_uuid.c | 56 ++++++++++++++++++++++++++++++++\n lib/eal/include/rte_uuid.h       | 28 +++++++++++++++-\n lib/eal/version.map              |  2 ++\n 3 files changed, 85 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/eal/common/eal_common_uuid.c b/lib/eal/common/eal_common_uuid.c\nindex 0a80bfbb38..dfc7c75813 100644\n--- a/lib/eal/common/eal_common_uuid.c\n+++ b/lib/eal/common/eal_common_uuid.c\n@@ -3,12 +3,18 @@\n  */\n \n #include <stdio.h>\n+#include <stdbool.h>\n #include <string.h>\n #include <stdint.h>\n #include <stdlib.h>\n #include <ctype.h>\n+#include <time.h>\n \n+#include <rte_stdatomic.h>\n+#include <rte_random.h>\n+#include <rte_time.h>\n #include <rte_uuid.h>\n+#include <rte_os_shim.h>\n \n /* UUID packed form */\n struct uuid {\n@@ -165,3 +171,53 @@ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len)\n \t\tuuid.node[0], uuid.node[1], uuid.node[2],\n \t\tuuid.node[3], uuid.node[4], uuid.node[5]);\n }\n+\n+void rte_uuid_generate_random(rte_uuid_t out)\n+{\n+\tunion {\n+\t\tuint64_t words[2];\n+\t\trte_uuid_t uuid;\n+\t} buf;\n+\tstruct uuid uu;\n+\n+\t/* UUID is 128 bit */\n+\tbuf.words[0] = rte_rand();\n+\tbuf.words[1] = rte_rand();\n+\n+\t/* Mark these random bytes a version 4 random uuid */\n+\tuuid_unpack(buf.uuid, &uu);\n+\tuu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000;\n+\tuu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000;\n+\tuuid_pack(&uu, out);\n+}\n+\n+void rte_uuid_generate_time(rte_uuid_t out)\n+{\n+\tstruct uuid uu;\n+\tstruct timespec ts;\n+\tuint64_t ns, rnd;\n+\tstatic RTE_ATOMIC(uint16_t) sequence;\n+\n+\t/* The time value for UUID is 100ns since 15 October 1582 */\n+\tclock_gettime(CLOCK_REALTIME, &ts);\n+\n+\tns = ts.tv_nsec / 100;\n+\tns += (uint64_t) ts.tv_sec * (NSEC_PER_SEC / 100);\n+\tns += (((uint64_t) 0x01B21DD2) << 32) + 0x13814000;\n+\n+\tuu.time_low = (uint32_t) ns;\n+\tuu.time_mid = (uint16_t) (ns >> 32);\n+\tuu.time_hi_and_version = (uint16_t) (ns >> 48);\n+\tuu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000;\n+\tuu.clock_seq = rte_atomic_fetch_add_explicit(&sequence, 1, rte_memory_order_relaxed);\n+\n+\trnd = rte_rand();\n+\tmemcpy(uu.node, &rnd, 6);\n+\t/*\n+\t * Follow the convention so that random node part will not\n+\t * not match a valid MAC address,\n+\t */\n+\tuu.node[0] |= 0x1;\n+\n+\tuuid_pack(&uu, out);\n+}\ndiff --git a/lib/eal/include/rte_uuid.h b/lib/eal/include/rte_uuid.h\nindex cfefd4308a..928a8312d9 100644\n--- a/lib/eal/include/rte_uuid.h\n+++ b/lib/eal/include/rte_uuid.h\n@@ -18,6 +18,8 @@ extern \"C\" {\n #include <stddef.h>\n #include <string.h>\n \n+#include <rte_compat.h>\n+\n /**\n  * Struct describing a Universal Unique Identifier\n  */\n@@ -94,12 +96,36 @@ int\trte_uuid_parse(const char *in, rte_uuid_t uu);\n  * @param uu\n  *    UUID to format\n  * @param out\n- *    Resulting string buffer\n+ *    Resulting string bufferm\n  * @param len\n  *    Sizeof the available string buffer\n  */\n void\trte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len);\n \n+/**\n+ * Generate a random uuid\n+ *\n+ * Uses high quality pseudo-random generator rte_rand() to generate a universal\n+ * unique identifier.\n+ *\n+ * @param uu\n+ *   Resulting UUID\n+ */\n+__rte_experimental\n+void   rte_uuid_generate_random(rte_uuid_t uu);\n+\n+/**\n+ * Generate a uuid based on time stamp.\n+ *\n+ * Uses the current time and a random Ethernet MAC address to generate a\n+ * universal unique identifier.\n+ *\n+ * @param uu\n+ *   Resulting UUID\n+ */\n+__rte_experimental\n+void   rte_uuid_generate_time(rte_uuid_t uu);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/eal/version.map b/lib/eal/version.map\nindex 3df50c3fbb..5a8aa67244 100644\n--- a/lib/eal/version.map\n+++ b/lib/eal/version.map\n@@ -396,6 +396,8 @@ EXPERIMENTAL {\n \n \t# added in 24.03\n \trte_vfio_get_device_info; # WINDOWS_NO_EXPORT\n+\trte_uuid_generate_random;\n+\trte_uuid_generate_time;\n };\n \n INTERNAL {\n",
    "prefixes": [
        "v3",
        "1/2"
    ]
}