get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 44715,
    "url": "http://patches.dpdk.org/api/patches/44715/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180914110109.29900-2-i.maximets@samsung.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": "<20180914110109.29900-2-i.maximets@samsung.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180914110109.29900-2-i.maximets@samsung.com",
    "date": "2018-09-14T11:01:08",
    "name": "[v2,1/2] eal: add nanosleep based delay function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1c16a6947ba1a7b75537fc7c30f12f19406f10a7",
    "submitter": {
        "id": 323,
        "url": "http://patches.dpdk.org/api/people/323/?format=api",
        "name": "Ilya Maximets",
        "email": "i.maximets@samsung.com"
    },
    "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/20180914110109.29900-2-i.maximets@samsung.com/mbox/",
    "series": [
        {
            "id": 1320,
            "url": "http://patches.dpdk.org/api/series/1320/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1320",
            "date": "2018-09-14T11:01:07",
            "name": "CPU non-blocking delay",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/1320/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44715/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/44715/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 719B55B34;\n\tFri, 14 Sep 2018 12:59:54 +0200 (CEST)",
            "from mailout2.w1.samsung.com (mailout2.w1.samsung.com\n\t[210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 139874C92\n\tfor <dev@dpdk.org>; Fri, 14 Sep 2018 12:59:53 +0200 (CEST)",
            "from eucas1p1.samsung.com (unknown [182.198.249.206])\n\tby mailout2.w1.samsung.com (KnoxPortal) with ESMTP id\n\t20180914105951euoutp02a8c3135a7738a1db8262f74c4474134f~UPyLoCICM1722317223euoutp02s;\n\tFri, 14 Sep 2018 10:59:51 +0000 (GMT)",
            "from eusmges2new.samsung.com (unknown [203.254.199.244]) by\n\teucas1p1.samsung.com (KnoxPortal) with ESMTP id\n\t20180914105951eucas1p1f07f8239e9c1b0a14cf1c4fc766b497b~UPyLP1WtJ0515305153eucas1p1K;\n\tFri, 14 Sep 2018 10:59:51 +0000 (GMT)",
            "from eucas1p1.samsung.com ( [182.198.249.206]) by\n\teusmges2new.samsung.com (EUCPMTA) with SMTP id 27.6D.04294.7A49B9B5;\n\tFri, 14 Sep 2018 11:59:51 +0100 (BST)",
            "from eusmgms2.samsung.com (unknown [182.198.249.180]) by\n\teucas1p1.samsung.com (KnoxPortal) with ESMTP id\n\t20180914105950eucas1p1391d6eccd8ccd5a03e7f742f1d12bb9d~UPyKaMZ7P0514605146eucas1p1I;\n\tFri, 14 Sep 2018 10:59:50 +0000 (GMT)",
            "from eusync1.samsung.com ( [203.254.199.211]) by\n\teusmgms2.samsung.com (EUCPMTA) with SMTP id 0B.9A.04128.6A49B9B5;\n\tFri, 14 Sep 2018 11:59:50 +0100 (BST)",
            "from imaximets.rnd.samsung.ru ([106.109.129.180]) by\n\teusync1.samsung.com (Oracle Communications Messaging Server\n\t7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id\n\t<0PF1002IVL6ZB130@eusync1.samsung.com>; \n\tFri, 14 Sep 2018 11:59:50 +0100 (BST)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com\n\t20180914105951euoutp02a8c3135a7738a1db8262f74c4474134f~UPyLoCICM1722317223euoutp02s",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;\n\ts=mail20170921; t=1536922792;\n\tbh=Na83y14Flfx5BlKdYkfM/2uNbA+eE9uXTzkY4Be9wwM=;\n\th=From:To:Cc:Subject:Date:In-reply-to:References:From;\n\tb=r6ejSa7mxVzDjcwqxFtQAWgqxVjAOEyl97Fil/fzqcMh2CHGAwkbQ94lHgI586ZAJ\n\t52rfPv+J7fL1x1sFyXQR7W0aUU9lBPXvaB+t99fWq/SGxlHjGt3OleftRhruIrg2/P\n\tC+EsUMmVlg+wuJQBHvDK1TEKcFyHFu8gkMFvIXIA=",
        "X-AuditID": "cbfec7f4-84fff700000010c6-dc-5b9b94a79136",
        "From": "Ilya Maximets <i.maximets@samsung.com>",
        "To": "dev@dpdk.org",
        "Cc": "Jingjing Wu <jingjing.wu@intel.com>, Konstantin Ananyev\n\t<konstantin.ananyev@intel.com>, Wenzhuo Lu <wenzhuo.lu@intel.com>, Beilei\n\tXing <beilei.xing@intel.com>, Qi Zhang <qi.z.zhang@intel.com>, Xiao Wang\n\t<xiao.w.wang@intel.com>, Bruce Richardson <bruce.richardson@intel.com>,\n\tStephen Hemminger <stephen@networkplumber.org>, Keith Wiles\n\t<keith.wiles@intel.com>, Ilya Maximets <i.maximets@samsung.com>",
        "Date": "Fri, 14 Sep 2018 14:01:08 +0300",
        "Message-id": "<20180914110109.29900-2-i.maximets@samsung.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-reply-to": "<20180914110109.29900-1-i.maximets@samsung.com>",
        "X-Brightmail-Tracker": [
            "H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWy7djPc7rLp8yONvi+TcCi+0MLk8WNVfYW\n\t7z5tZ7K40v6T3WLmgs+MFlePf2e2eP9nEYvF9A39bBaL78hZbD3zl9Fi//PD7A7cHr8WLGX1\n\tWLznJZNHz8l5TB59W1YxBrBEcdmkpOZklqUW6dslcGXcer+bseC+bsXKltmsDYwvVLoYOTkk\n\tBEwk7uyZwgZiCwmsYJR41iTexcgFZH9mlOh4fYYNpmjWzYMsEIlljBLnPjQyQTjNTBJfV71k\n\tB6liE9CROLX6CCOILSIgIPG5czEbSBGzwBxmicZVe4AcDg5hAXuJLS+TQGpYBFQlvncfYwWx\n\teQWsJVZ1/ITaJi+xesMBZhCbU8BG4tqlIywQ8QVsEuvPyoGMkRBwkbg10w0iLCzx6vgWdghb\n\tRuLy5G6o8nqJ+y0vGUFOkBDoYJSYfugfE0QC6ITX58AamAX4JCZtm84MMZNXoqNNCKLEQ2LZ\n\t0pPsED/+YZTov7mDcQKj5AJGhlWM4qmlxbnpqcVGeanlesWJucWleel6yfm5mxiBkXn63/Ev\n\tOxh3/Uk6xCjAwajEw+vwfFa0EGtiWXFl7iFGCQ5mJRHe9aFAId6UxMqq1KL8+KLSnNTiQ4zS\n\tHCxK4rx8WmnRQgLpiSWp2ampBalFMFkmDk6pBsZciUduF0+kfPPMiind6Hvi5NeKSct65m/O\n\tF+Sb8PnI+/L9vqziqq0XJii5280PnlFzNePQo8PlM0/YnI3vnnFyW96fC7PVTtz5br5TVT/g\n\toNF3p5ZpUi7sZZqFgitle5OvXLvtfdf0jedDo+cyX/qTpGZYJ/46L3X9vM7ZV7F7BbQv7lO/\n\tH22uxFKckWioxVxUnAgAwTT7SsgCAAA=",
            "H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t/xy7rLpsyONpiyRcKi+0MLk8WNVfYW\n\t7z5tZ7K40v6T3WLmgs+MFlePf2e2eP9nEYvF9A39bBaL78hZbD3zl9Fi//PD7A7cHr8WLGX1\n\tWLznJZNHz8l5TB59W1YxBrBEcdmkpOZklqUW6dslcGXcer+bseC+bsXKltmsDYwvVLoYOTkk\n\tBEwkZt08yNLFyMUhJLCEUaJh8yN2CKeVSWLRxQlsIFVsAjoSp1YfYQSxRQQEJD53LmYDKWIW\n\tmMcsceP/IaAEB4ewgL3ElpdJIDUsAqoS37uPsYLYvALWEqs6frJBbJOXWL3hADOIzSlgI3Ht\n\t0hEWEFtIYBWjRO8O6QmMPAsYGVYxiqSWFuem5xYb6RUn5haX5qXrJefnbmIEBta2Yz+37GDs\n\tehd8iFGAg1GJh9fh+axoIdbEsuLK3EOMEhzMSiK860OBQrwpiZVVqUX58UWlOanFhxilOViU\n\txHnPG1RGCQmkJ5akZqemFqQWwWSZODilGhh5fudcLpP54dq+/lph5eGMOBlNrYMyrxuYo2q2\n\t1AjFvl+yOnnGYYNJvnfdD/HaTWxgSDiXOeXsz+vPV5fw3AueMNU/nUVQawPzsajy8nmtRzJm\n\tSJc9E5WwkrpyxlhFd36w4Mqzm7gff9u6w3vN9MmrL5RXcdduXjdDddL5siK78/+PtLNdW7FS\n\tiaU4I9FQi7moOBEAGeVu/ygCAAA="
        ],
        "X-CMS-MailID": "20180914105950eucas1p1391d6eccd8ccd5a03e7f742f1d12bb9d",
        "X-Msg-Generator": "CA",
        "CMS-TYPE": "201P",
        "X-CMS-RootMailID": "20180914105950eucas1p1391d6eccd8ccd5a03e7f742f1d12bb9d",
        "References": "<20180903144311eucas1p2b6499c49dbd0d54334e973113cdc5ad6~Q6vBsFYRm1033710337eucas1p2D@eucas1p2.samsung.com>\n\t<20180914110109.29900-1-i.maximets@samsung.com>\n\t<CGME20180914105950eucas1p1391d6eccd8ccd5a03e7f742f1d12bb9d@eucas1p1.samsung.com>",
        "Subject": "[dpdk-dev] [PATCH v2 1/2] eal: add nanosleep based delay function",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add a new rte_delay_us_sleep() function that uses nanosleep().\nThis function can be used by applications to not implement\ntheir own nanosleep() based callback and by internal DPDK\ncode if CPU non-blocking delay needed.\n\nSigned-off-by: Ilya Maximets <i.maximets@samsung.com>\n---\n lib/librte_eal/common/eal_common_timer.c      | 24 +++++++++\n .../common/include/generic/rte_cycles.h       | 11 ++++\n lib/librte_eal/rte_eal_version.map            |  1 +\n test/test/autotest_data.py                    |  6 +++\n test/test/meson.build                         |  1 +\n test/test/test_cycles.c                       | 51 ++++++++++++++-----\n 6 files changed, 80 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_timer.c b/lib/librte_eal/common/eal_common_timer.c\nindex 2e2b770fb..c6344ca87 100644\n--- a/lib/librte_eal/common/eal_common_timer.c\n+++ b/lib/librte_eal/common/eal_common_timer.c\n@@ -7,9 +7,11 @@\n #include <unistd.h>\n #include <inttypes.h>\n #include <sys/types.h>\n+#include <time.h>\n #include <errno.h>\n \n #include <rte_common.h>\n+#include <rte_compat.h>\n #include <rte_log.h>\n #include <rte_cycles.h>\n #include <rte_pause.h>\n@@ -31,6 +33,28 @@ rte_delay_us_block(unsigned int us)\n \t\trte_pause();\n }\n \n+void __rte_experimental\n+rte_delay_us_sleep(unsigned int us)\n+{\n+\tstruct timespec wait[2];\n+\tint ind = 0;\n+\n+\twait[0].tv_sec = 0;\n+\tif (us >= US_PER_S) {\n+\t\twait[0].tv_sec = us / US_PER_S;\n+\t\tus -= wait[0].tv_sec * US_PER_S;\n+\t}\n+\twait[0].tv_nsec = 1000 * us;\n+\n+\twhile (nanosleep(&wait[ind], &wait[1 - ind]) == EINTR) {\n+\t\t/*\n+\t\t * Sleep was interrupted. Flip the index, so the 'remainder'\n+\t\t * will become the 'request' for a next call.\n+\t\t */\n+\t\tind = 1 - ind;\n+\t}\n+}\n+\n uint64_t\n rte_get_tsc_hz(void)\n {\ndiff --git a/lib/librte_eal/common/include/generic/rte_cycles.h b/lib/librte_eal/common/include/generic/rte_cycles.h\nindex 0ff1af504..ac379e878 100644\n--- a/lib/librte_eal/common/include/generic/rte_cycles.h\n+++ b/lib/librte_eal/common/include/generic/rte_cycles.h\n@@ -13,6 +13,7 @@\n  */\n \n #include <stdint.h>\n+#include <rte_compat.h>\n #include <rte_debug.h>\n #include <rte_atomic.h>\n \n@@ -157,6 +158,16 @@ rte_delay_ms(unsigned ms)\n  */\n void rte_delay_us_block(unsigned int us);\n \n+/**\n+ * Delay function that uses system sleep.\n+ * Does not block the CPU core.\n+ *\n+ * @param us\n+ *   Number of microseconds to wait.\n+ */\n+void __rte_experimental\n+rte_delay_us_sleep(unsigned int us);\n+\n /**\n  * Replace rte_delay_us with user defined function.\n  *\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex 344a43d32..d68777ce0 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -270,6 +270,7 @@ EXPERIMENTAL {\n \trte_class_register;\n \trte_class_unregister;\n \trte_ctrl_thread_create;\n+\trte_delay_us_sleep;\n \trte_dev_event_callback_register;\n \trte_dev_event_callback_unregister;\n \trte_dev_event_monitor_start;\ndiff --git a/test/test/autotest_data.py b/test/test/autotest_data.py\nindex f68d9b111..874d0cb53 100644\n--- a/test/test/autotest_data.py\n+++ b/test/test/autotest_data.py\n@@ -278,6 +278,12 @@\n         \"Func\":    default_autotest,\n         \"Report\":  None,\n     },\n+    {\n+        \"Name\":    \"Sleep delay\",\n+        \"Command\": \"delay_us_sleep_autotest\",\n+        \"Func\":    default_autotest,\n+        \"Report\":  None,\n+    },\n     {\n         \"Name\":    \"Rawdev autotest\",\n         \"Command\": \"rawdev_autotest\",\ndiff --git a/test/test/meson.build b/test/test/meson.build\nindex b1dd6eca2..0078aea30 100644\n--- a/test/test/meson.build\n+++ b/test/test/meson.build\n@@ -143,6 +143,7 @@ test_names = [\n \t'cryptodev_dpaa_sec_autotest',\n \t'cycles_autotest',\n \t'debug_autotest',\n+\t'delay_us_sleep_autotest',\n \t'devargs_autotest',\n \t'distributor_autotest',\n \t'distributor_perf_autotest',\ndiff --git a/test/test/test_cycles.c b/test/test/test_cycles.c\nindex 149f60b07..c78e6a5b1 100644\n--- a/test/test/test_cycles.c\n+++ b/test/test/test_cycles.c\n@@ -23,6 +23,30 @@\n  *   of cycles is correct with regard to the frequency of the timer.\n  */\n \n+static int\n+check_wait_one_second(void)\n+{\n+\tuint64_t cycles, prev_cycles;\n+\tuint64_t hz = rte_get_timer_hz();\n+\tuint64_t max_inc = (hz / 100); /* 10 ms max between 2 reads */\n+\n+\t/* check that waiting 1 second is precise */\n+\tprev_cycles = rte_get_timer_cycles();\n+\trte_delay_us(1000000);\n+\tcycles = rte_get_timer_cycles();\n+\n+\tif ((uint64_t)(cycles - prev_cycles) > (hz + max_inc)) {\n+\t\tprintf(\"delay_us is not accurate: too long\\n\");\n+\t\treturn -1;\n+\t}\n+\tif ((uint64_t)(cycles - prev_cycles) < (hz - max_inc)) {\n+\t\tprintf(\"delay_us is not accurate: too short\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n test_cycles(void)\n {\n@@ -43,24 +67,23 @@ test_cycles(void)\n \t\tprev_cycles = cycles;\n \t}\n \n-\t/* check that waiting 1 second is precise */\n-\tprev_cycles = rte_get_timer_cycles();\n-\trte_delay_us(1000000);\n-\tcycles = rte_get_timer_cycles();\n+\treturn check_wait_one_second();\n+}\n \n-\tif ((uint64_t)(cycles - prev_cycles) > (hz + max_inc)) {\n-\t\tprintf(\"delay_us is not accurate: too long\\n\");\n-\t\treturn -1;\n-\t}\n-\tif ((uint64_t)(cycles - prev_cycles) < (hz - max_inc)) {\n-\t\tprintf(\"delay_us is not accurate: too short\\n\");\n-\t\treturn -1;\n-\t}\n+REGISTER_TEST_COMMAND(cycles_autotest, test_cycles);\n \n-\treturn 0;\n+/*\n+ * One second precision test with rte_delay_us_sleep.\n+ */\n+\n+static int\n+test_delay_us_sleep(void)\n+{\n+\trte_delay_us_callback_register(rte_delay_us_sleep);\n+\treturn check_wait_one_second();\n }\n \n-REGISTER_TEST_COMMAND(cycles_autotest, test_cycles);\n+REGISTER_TEST_COMMAND(delay_us_sleep_autotest, test_delay_us_sleep);\n \n /*\n  * rte_delay_us_callback test\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}