get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 96552,
    "url": "http://patches.dpdk.org/api/patches/96552/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1627925546-29982-2-git-send-email-navasile@linux.microsoft.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": "<1627925546-29982-2-git-send-email-navasile@linux.microsoft.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1627925546-29982-2-git-send-email-navasile@linux.microsoft.com",
    "date": "2021-08-02T17:32:17",
    "name": "[v12,01/10] eal: add basic threading functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "bca5db870149ff0a241f38d2f311c791c13d6e9b",
    "submitter": {
        "id": 1668,
        "url": "http://patches.dpdk.org/api/people/1668/?format=api",
        "name": "Narcisa Ana Maria Vasile",
        "email": "navasile@linux.microsoft.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1627925546-29982-2-git-send-email-navasile@linux.microsoft.com/mbox/",
    "series": [
        {
            "id": 18146,
            "url": "http://patches.dpdk.org/api/series/18146/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18146",
            "date": "2021-08-02T17:32:16",
            "name": "eal: Add EAL API for threading",
            "version": 12,
            "mbox": "http://patches.dpdk.org/series/18146/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/96552/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/96552/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 0F4CBA0C41;\n\tMon,  2 Aug 2021 19:32:36 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 08D6D41180;\n\tMon,  2 Aug 2021 19:32:33 +0200 (CEST)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id 9AA8841178\n for <dev@dpdk.org>; Mon,  2 Aug 2021 19:32:31 +0200 (CEST)",
            "by linux.microsoft.com (Postfix, from userid 1059)\n id F3C0F20B36E8; Mon,  2 Aug 2021 10:32:30 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com F3C0F20B36E8",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1627925551;\n bh=7aL63cJaVVmchmCQj0+zlg7rECJq5GTxPT/dhAmuskU=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=G/JTvBOx+/IrlmUOHiRhjfv7t6uVmOFzg82swqdewEYbPTiSDnyXvaRdgXWB0k2oG\n cEF27mpLp0YLeI9/oRe6uYRoEez0hXWecbwx1qHslsi/Sd4HX3S71Jvv45HfmxbJfA\n LzNwF5bhy2mROpAypajtN52G3YE8wADKovCfMjyg=",
        "From": "Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>",
        "To": "dev@dpdk.org, thomas@monjalon.net, dmitry.kozliuk@gmail.com,\n khot@microsoft.com, navasile@microsoft.com, dmitrym@microsoft.com,\n roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com",
        "Cc": "bruce.richardson@intel.com, david.marchand@redhat.com,\n pallavi.kadam@intel.com",
        "Date": "Mon,  2 Aug 2021 10:32:17 -0700",
        "Message-Id": "<1627925546-29982-2-git-send-email-navasile@linux.microsoft.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1627925546-29982-1-git-send-email-navasile@linux.microsoft.com>",
        "References": "<1627684312-28630-1-git-send-email-navasile@linux.microsoft.com>\n <1627925546-29982-1-git-send-email-navasile@linux.microsoft.com>",
        "Subject": "[dpdk-dev] [PATCH v12 01/10] eal: add basic threading functions",
        "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": "From: Narcisa Vasile <navasile@microsoft.com>\n\nUse a portable, type-safe representation for the thread identifier.\nAdd functions for comparing thread ids and obtaining the thread id\nfor the current thread.\n\nSigned-off-by: Narcisa Vasile <navasile@microsoft.com>\n---\n lib/eal/common/meson.build            |  1 +\n lib/eal/{unix => common}/rte_thread.c | 57 ++++++++++++++++-----------\n lib/eal/include/rte_thread.h          | 48 +++++++++++++++++-----\n lib/eal/unix/meson.build              |  1 -\n lib/eal/version.map                   |  3 ++\n lib/eal/windows/rte_thread.c          | 17 ++++++++\n 6 files changed, 95 insertions(+), 32 deletions(-)\n rename lib/eal/{unix => common}/rte_thread.c (66%)",
    "diff": "diff --git a/lib/eal/common/meson.build b/lib/eal/common/meson.build\nindex edfca77779..eda250247b 100644\n--- a/lib/eal/common/meson.build\n+++ b/lib/eal/common/meson.build\n@@ -80,6 +80,7 @@ sources += files(\n         'rte_random.c',\n         'rte_reciprocal.c',\n         'rte_service.c',\n+        'rte_thread.c',\n         'rte_version.c',\n )\n \ndiff --git a/lib/eal/unix/rte_thread.c b/lib/eal/common/rte_thread.c\nsimilarity index 66%\nrename from lib/eal/unix/rte_thread.c\nrename to lib/eal/common/rte_thread.c\nindex c72d619ec1..92a7451b0a 100644\n--- a/lib/eal/unix/rte_thread.c\n+++ b/lib/eal/common/rte_thread.c\n@@ -1,5 +1,6 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n  * Copyright 2021 Mellanox Technologies, Ltd\n+ * Copyright(c) 2021 Microsoft Corporation\n  */\n \n #include <errno.h>\n@@ -16,25 +17,41 @@ struct eal_tls_key {\n \tpthread_key_t thread_index;\n };\n \n+rte_thread_t\n+rte_thread_self(void)\n+{\n+\trte_thread_t thread_id;\n+\n+\tthread_id.opaque_id = (uintptr_t)pthread_self();\n+\n+\treturn thread_id;\n+}\n+\n+int\n+rte_thread_equal(rte_thread_t t1, rte_thread_t t2)\n+{\n+\treturn pthread_equal((pthread_t)t1.opaque_id, (pthread_t)t2.opaque_id);\n+}\n+\n int\n rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *))\n {\n \tint err;\n+\trte_thread_key k;\n \n-\t*key = malloc(sizeof(**key));\n-\tif ((*key) == NULL) {\n+\tk = malloc(sizeof(*k));\n+\tif (k == NULL) {\n \t\tRTE_LOG(DEBUG, EAL, \"Cannot allocate TLS key.\\n\");\n-\t\trte_errno = ENOMEM;\n-\t\treturn -1;\n+\t\treturn EINVAL;\n \t}\n-\terr = pthread_key_create(&((*key)->thread_index), destructor);\n-\tif (err) {\n+\terr = pthread_key_create(&(k->thread_index), destructor);\n+\tif (err != 0) {\n \t\tRTE_LOG(DEBUG, EAL, \"pthread_key_create failed: %s\\n\",\n \t\t\t strerror(err));\n-\t\tfree(*key);\n-\t\trte_errno = ENOEXEC;\n-\t\treturn -1;\n+\t\tfree(k);\n+\t\treturn err;\n \t}\n+\t*key = k;\n \treturn 0;\n }\n \n@@ -43,18 +60,16 @@ rte_thread_key_delete(rte_thread_key key)\n {\n \tint err;\n \n-\tif (!key) {\n+\tif (key == NULL) {\n \t\tRTE_LOG(DEBUG, EAL, \"Invalid TLS key.\\n\");\n-\t\trte_errno = EINVAL;\n-\t\treturn -1;\n+\t\treturn EINVAL;\n \t}\n \terr = pthread_key_delete(key->thread_index);\n-\tif (err) {\n+\tif (err != 0) {\n \t\tRTE_LOG(DEBUG, EAL, \"pthread_key_delete failed: %s\\n\",\n \t\t\t strerror(err));\n \t\tfree(key);\n-\t\trte_errno = ENOEXEC;\n-\t\treturn -1;\n+\t\treturn err;\n \t}\n \tfree(key);\n \treturn 0;\n@@ -65,17 +80,15 @@ rte_thread_value_set(rte_thread_key key, const void *value)\n {\n \tint err;\n \n-\tif (!key) {\n+\tif (key == NULL) {\n \t\tRTE_LOG(DEBUG, EAL, \"Invalid TLS key.\\n\");\n-\t\trte_errno = EINVAL;\n-\t\treturn -1;\n+\t\treturn EINVAL;\n \t}\n \terr = pthread_setspecific(key->thread_index, value);\n-\tif (err) {\n+\tif (err != 0) {\n \t\tRTE_LOG(DEBUG, EAL, \"pthread_setspecific failed: %s\\n\",\n \t\t\tstrerror(err));\n-\t\trte_errno = ENOEXEC;\n-\t\treturn -1;\n+\t\treturn err;\n \t}\n \treturn 0;\n }\n@@ -83,7 +96,7 @@ rte_thread_value_set(rte_thread_key key, const void *value)\n void *\n rte_thread_value_get(rte_thread_key key)\n {\n-\tif (!key) {\n+\tif (key == NULL) {\n \t\tRTE_LOG(DEBUG, EAL, \"Invalid TLS key.\\n\");\n \t\trte_errno = EINVAL;\n \t\treturn NULL;\ndiff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h\nindex 8be8ed8f36..748f64d230 100644\n--- a/lib/eal/include/rte_thread.h\n+++ b/lib/eal/include/rte_thread.h\n@@ -1,6 +1,8 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n  * Copyright(c) 2021 Mellanox Technologies, Ltd\n+ * Copyright(c) 2021 Microsoft Corporation\n  */\n+#include <stdint.h>\n \n #include <rte_os.h>\n #include <rte_compat.h>\n@@ -20,11 +22,45 @@\n extern \"C\" {\n #endif\n \n+#include <sched.h>\n+\n+/**\n+ * Thread id descriptor.\n+ */\n+typedef struct rte_thread_tag {\n+\tuintptr_t opaque_id; /**< thread identifier */\n+} rte_thread_t;\n+\n /**\n  * TLS key type, an opaque pointer.\n  */\n typedef struct eal_tls_key *rte_thread_key;\n \n+/**\n+ * Get the id of the calling thread.\n+ *\n+ * @return\n+ *   Return the thread id of the calling thread.\n+ */\n+__rte_experimental\n+rte_thread_t rte_thread_self(void);\n+\n+/**\n+ * Check if 2 thread ids are equal.\n+ *\n+ * @param t1\n+ *   First thread id.\n+ *\n+ * @param t2\n+ *   Second thread id.\n+ *\n+ * @return\n+ *   If the ids are equal, return nonzero.\n+ *   Otherwise, return 0.\n+ */\n+__rte_experimental\n+int rte_thread_equal(rte_thread_t t1, rte_thread_t t2);\n+\n #ifdef RTE_HAS_CPUSET\n \n /**\n@@ -63,9 +99,7 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);\n  *\n  * @return\n  *   On success, zero.\n- *   On failure, a negative number and an error number is set in rte_errno.\n- *   rte_errno can be: ENOMEM  - Memory allocation error.\n- *                     ENOEXEC - Specific OS error.\n+ *   On failure, return a positive errno-style error number.\n  */\n \n __rte_experimental\n@@ -80,9 +114,7 @@ int rte_thread_key_create(rte_thread_key *key,\n  *\n  * @return\n  *   On success, zero.\n- *   On failure, a negative number and an error number is set in rte_errno.\n- *   rte_errno can be: EINVAL  - Invalid parameter passed.\n- *                     ENOEXEC - Specific OS error.\n+ *   On failure, return a positive errno-style error number.\n  */\n __rte_experimental\n int rte_thread_key_delete(rte_thread_key key);\n@@ -97,9 +129,7 @@ int rte_thread_key_delete(rte_thread_key key);\n  *\n  * @return\n  *   On success, zero.\n- *   On failure, a negative number and an error number is set in rte_errno.\n- *   rte_errno can be: EINVAL  - Invalid parameter passed.\n- *                     ENOEXEC - Specific OS error.\n+ *   On failure, return a positive errno-style error number.\n  */\n __rte_experimental\n int rte_thread_value_set(rte_thread_key key, const void *value);\ndiff --git a/lib/eal/unix/meson.build b/lib/eal/unix/meson.build\nindex e3ecd3e956..cb6d233721 100644\n--- a/lib/eal/unix/meson.build\n+++ b/lib/eal/unix/meson.build\n@@ -6,5 +6,4 @@ sources += files(\n         'eal_unix_memory.c',\n         'eal_unix_timer.c',\n         'eal_firmware.c',\n-        'rte_thread.c',\n )\ndiff --git a/lib/eal/version.map b/lib/eal/version.map\nindex 887012d02a..ba7dcda664 100644\n--- a/lib/eal/version.map\n+++ b/lib/eal/version.map\n@@ -426,6 +426,9 @@ EXPERIMENTAL {\n \n \t# added in 21.08\n \trte_power_monitor_multi; # WINDOWS_NO_EXPORT\n+\n+\trte_thread_self;\n+\trte_thread_equal;\n };\n \n INTERNAL {\ndiff --git a/lib/eal/windows/rte_thread.c b/lib/eal/windows/rte_thread.c\nindex 667287c387..41c354818b 100644\n--- a/lib/eal/windows/rte_thread.c\n+++ b/lib/eal/windows/rte_thread.c\n@@ -1,5 +1,6 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n  * Copyright 2021 Mellanox Technologies, Ltd\n+ * Copyright(c) 2021 Microsoft Corporation\n  */\n \n #include <rte_common.h>\n@@ -11,6 +12,22 @@ struct eal_tls_key {\n \tDWORD thread_index;\n };\n \n+rte_thread_t\n+rte_thread_self(void)\n+{\n+\trte_thread_t thread_id;\n+\n+\tthread_id.opaque_id = GetCurrentThreadId();\n+\n+\treturn thread_id;\n+}\n+\n+int\n+rte_thread_equal(rte_thread_t t1, rte_thread_t t2)\n+{\n+\treturn t1.opaque_id == t2.opaque_id;\n+}\n+\n int\n rte_thread_key_create(rte_thread_key *key,\n \t\t__rte_unused void (*destructor)(void *))\n",
    "prefixes": [
        "v12",
        "01/10"
    ]
}