get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 71713,
    "url": "https://patches.dpdk.org/api/patches/71713/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200618065522.22884-3-fady@mellanox.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": "<20200618065522.22884-3-fady@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200618065522.22884-3-fady@mellanox.com",
    "date": "2020-06-18T06:55:22",
    "name": "[v10,2/2] timer: support EAL functions on Windows",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8abc4ca4a7163082c6a2bc3d0a411b4aeb183461",
    "submitter": {
        "id": 1650,
        "url": "https://patches.dpdk.org/api/people/1650/?format=api",
        "name": "Fady Bader",
        "email": "fady@mellanox.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/20200618065522.22884-3-fady@mellanox.com/mbox/",
    "series": [
        {
            "id": 10495,
            "url": "https://patches.dpdk.org/api/series/10495/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10495",
            "date": "2020-06-18T06:55:22",
            "name": "eal timer split and implementation for Windows",
            "version": 10,
            "mbox": "https://patches.dpdk.org/series/10495/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/71713/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/71713/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 43572A04A5;\n\tThu, 18 Jun 2020 08:55:37 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 25C63DE0;\n\tThu, 18 Jun 2020 08:55:37 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id 050AEE07\n for <dev@dpdk.org>; Thu, 18 Jun 2020 08:55:35 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n fady@mellanox.com) with SMTP; 18 Jun 2020 09:55:32 +0300",
            "from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx\n [10.237.1.5])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05I6tWgd016083;\n Thu, 18 Jun 2020 09:55:32 +0300"
        ],
        "From": "Fady Bader <fady@mellanox.com>",
        "To": "dev@dpdk.org",
        "Cc": "fady@mellanox.com, thomas@monjalon.net, tbashar@mellanox.com,\n talshn@mellanox.com, yohadt@mellanox.com, dmitry.kozliuk@gmail.com,\n harini.ramakrishnan@microsoft.com, ocardona@microsoft.com,\n pallavi.kadam@intel.com, ranjit.menon@intel.com",
        "Date": "Thu, 18 Jun 2020 09:55:22 +0300",
        "Message-Id": "<20200618065522.22884-3-fady@mellanox.com>",
        "X-Mailer": "git-send-email 2.16.1.windows.4",
        "In-Reply-To": "<20200618065522.22884-1-fady@mellanox.com>",
        "References": "<20200423144350.4016-2-fady@mellanox.com>\n <20200618065522.22884-1-fady@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v10 2/2] timer: support EAL functions on Windows",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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": "Implemented the needed Windows eal timer functions.\n\nSigned-off-by: Fady Bader <fady@mellanox.com>\n---\n lib/librte_eal/common/meson.build       |  1 +\n lib/librte_eal/windows/eal.c            |  6 +++\n lib/librte_eal/windows/eal_timer.c      | 93 +++++++++++++++++++++++++++++++++\n lib/librte_eal/windows/include/rte_os.h |  2 +\n lib/librte_eal/windows/meson.build      |  1 +\n 5 files changed, 103 insertions(+)\n create mode 100644 lib/librte_eal/windows/eal_timer.c",
    "diff": "diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build\nindex 3108442697..4bdf77922f 100644\n--- a/lib/librte_eal/common/meson.build\n+++ b/lib/librte_eal/common/meson.build\n@@ -26,6 +26,7 @@ if is_windows\n \t\t'malloc_elem.c',\n \t\t'malloc_heap.c',\n \t\t'rte_malloc.c',\n+\t\t'eal_common_timer.c',\n \t)\n \tsubdir_done()\n endif\ndiff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c\nindex 427a5557fa..b6bffd3d92 100644\n--- a/lib/librte_eal/windows/eal.c\n+++ b/lib/librte_eal/windows/eal.c\n@@ -354,6 +354,12 @@ rte_eal_init(int argc, char **argv)\n \t\treturn -1;\n \t}\n \n+\tif (rte_eal_timer_init() < 0) {\n+\t\trte_eal_init_alert(\"Cannot init TSC timer\");\n+\t\trte_errno = EFAULT;\n+\t\treturn -1;\n+\t}\n+\n \teal_thread_init_master(rte_config.master_lcore);\n \n \tRTE_LCORE_FOREACH_SLAVE(i) {\ndiff --git a/lib/librte_eal/windows/eal_timer.c b/lib/librte_eal/windows/eal_timer.c\nnew file mode 100644\nindex 0000000000..1f0cae631c\n--- /dev/null\n+++ b/lib/librte_eal/windows/eal_timer.c\n@@ -0,0 +1,93 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2020 Mellanox Technologies, Ltd\n+ */\n+#include <inttypes.h>\n+\n+#include <rte_windows.h>\n+#include <rte_common.h>\n+#include <rte_cycles.h>\n+#include <rte_eal.h>\n+#include <rte_errno.h>\n+#include \"eal_private.h\"\n+\n+#define US_PER_SEC 1E6\n+#define CYC_PER_10MHZ 1E7\n+\n+void\n+rte_delay_us_sleep(unsigned int us)\n+{\n+\tHANDLE timer;\n+\tLARGE_INTEGER due_time;\n+\n+\t/* create waitable timer */\n+\ttimer = CreateWaitableTimer(NULL, TRUE, NULL);\n+\tif (!timer) {\n+\t\tRTE_LOG_WIN32_ERR(\"CreateWaitableTimer()\");\n+\t\trte_errno = ENOMEM;\n+\t\treturn;\n+\t}\n+\n+\t/*\n+\t * due_time's uom is 100 ns, multiply by 10 to convert to microseconds\n+\t * set us microseconds time for timer\n+\t */\n+\tdue_time.QuadPart = -((int64_t)us * 10);\n+\tif (!SetWaitableTimer(timer, &due_time, 0, NULL, NULL, FALSE)) {\n+\t\tRTE_LOG_WIN32_ERR(\"SetWaitableTimer()\");\n+\t\trte_errno = EINVAL;\n+\t\tgoto end;\n+\t}\n+\t/* start wait for timer for us microseconds */\n+\tif (WaitForSingleObject(timer, INFINITE) == WAIT_FAILED) {\n+\t\tRTE_LOG_WIN32_ERR(\"WaitForSingleObject()\");\n+\t\trte_errno = EINVAL;\n+\t}\n+\n+end:\n+\tCloseHandle(timer);\n+}\n+\n+uint64_t\n+get_tsc_freq(void)\n+{\n+\tLARGE_INTEGER t_start, t_end, elapsed_us;\n+\tLARGE_INTEGER frequency;\n+\tuint64_t tsc_hz;\n+\tuint64_t end, start;\n+\n+\tQueryPerformanceFrequency(&frequency);\n+\n+\tQueryPerformanceCounter(&t_start);\n+\tstart = rte_get_tsc_cycles();\n+\n+\trte_delay_us_sleep(US_PER_SEC / 10); /* 1/10 second */\n+\n+\tif (rte_errno != 0)\n+\t\treturn 0;\n+\n+\tQueryPerformanceCounter(&t_end);\n+\tend = rte_get_tsc_cycles();\n+\n+\telapsed_us.QuadPart = t_end.QuadPart - t_start.QuadPart;\n+\n+\t/*\n+\t * To guard against loss-of-precision, convert to microseconds\n+\t * *before* dividing by ticks-per-second.\n+\t */\n+\telapsed_us.QuadPart *= US_PER_SEC;\n+\telapsed_us.QuadPart /= frequency.QuadPart;\n+\n+\tdouble secs = ((double)elapsed_us.QuadPart)/US_PER_SEC;\n+\ttsc_hz = (uint64_t)((end - start)/secs);\n+\n+\t/* Round up to 10Mhz. 1E7 ~ 10Mhz */\n+\treturn RTE_ALIGN_MUL_NEAR(tsc_hz, CYC_PER_10MHZ);\n+}\n+\n+\n+int\n+rte_eal_timer_init(void)\n+{\n+\tset_tsc_freq();\n+\treturn 0;\n+}\ndiff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h\nindex cb10d6494f..569ed92d51 100644\n--- a/lib/librte_eal/windows/include/rte_os.h\n+++ b/lib/librte_eal/windows/include/rte_os.h\n@@ -25,6 +25,8 @@ extern \"C\" {\n #define PATH_MAX _MAX_PATH\n #endif\n \n+#define sleep(x) Sleep(1000 * (x))\n+\n #define strerror_r(a, b, c) strerror_s(b, c, a)\n \n /* strdup is deprecated in Microsoft libc and _strdup is preferred */\ndiff --git a/lib/librte_eal/windows/meson.build b/lib/librte_eal/windows/meson.build\nindex ded5a2b808..08c888e018 100644\n--- a/lib/librte_eal/windows/meson.build\n+++ b/lib/librte_eal/windows/meson.build\n@@ -14,6 +14,7 @@ sources += files(\n \t'eal_memory.c',\n \t'eal_mp.c',\n \t'eal_thread.c',\n+\t'eal_timer.c',\n \t'fnmatch.c',\n \t'getopt.c',\n )\n",
    "prefixes": [
        "v10",
        "2/2"
    ]
}