get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 30320,
    "url": "http://patches.dpdk.org/api/patches/30320/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20171013000247.4158-5-thomas@monjalon.net/",
    "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": "<20171013000247.4158-5-thomas@monjalon.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20171013000247.4158-5-thomas@monjalon.net",
    "date": "2017-10-13T00:02:47",
    "name": "[dpdk-dev,4/4] eal/x86: implement arch-specific TSC freq query",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "09c50d8e3048cf5cd127d7177b5721b322408191",
    "submitter": {
        "id": 685,
        "url": "http://patches.dpdk.org/api/people/685/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas@monjalon.net"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20171013000247.4158-5-thomas@monjalon.net/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/30320/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/30320/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 20AA81B5EA;\n\tFri, 13 Oct 2017 02:03:01 +0200 (CEST)",
            "from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com\n\t[66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 50D521B3BA\n\tfor <dev@dpdk.org>; Fri, 13 Oct 2017 02:02:57 +0200 (CEST)",
            "from compute1.internal (compute1.nyi.internal [10.202.2.41])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 0B01621969;\n\tThu, 12 Oct 2017 20:02:57 -0400 (EDT)",
            "from frontend2 ([10.202.2.161])\n\tby compute1.internal (MEProxy); Thu, 12 Oct 2017 20:02:57 -0400",
            "from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id 044AE24738;\n\tThu, 12 Oct 2017 20:02:55 -0400 (EDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n\tcc:date:from:in-reply-to:message-id:references:subject:to\n\t:x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=ztZQrH7SumqhCH\n\tiRuXPTGumJX8jBeRjurNgXuRw1H/w=; b=pKggRHjiJVhApZG9FlRQpPsV+mFUoG\n\t3S8Uwqk5EngYdjK5idQi4BqEabiYwvjBL39HllXCmTxHTnL+B3onP9ORpwSS4fR8\n\tFHayiuPsTcIX5OErcbPtj8hHUSgR7trOzoGYoLPVVRgB8/MF7iO1kp+wyks4mfLL\n\t06Q7h9V9nosRo=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:date:from:in-reply-to:message-id\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=\n\tfm1; bh=ztZQrH7SumqhCHiRuXPTGumJX8jBeRjurNgXuRw1H/w=; b=imGrl3AU\n\tw8zDPzIgIylKmKHf5Bf/yt6CdFhGWWaRZ8rZF+7554bwFU8iQVI+ryUbDKe/2+qP\n\tEhB3qQkD4qrUf2HbBfXUlzNCNuobro19+wyBYhxYaVYBwohvhiq9klPYLdtXgjpl\n\tio2lfebAXfD14l+keF/vC+rK5aj6DNrrvP3AYaK2CFcu+4eKlTxUUCrC/xXo09KT\n\tSLsaLb6qg8zs47eU03ncLyO8cQgxeQskK1IFwlygl+zUtBmYlovcoy7qpBwazvXt\n\t5X4/R5UT+RNOoc+d0BJ154mNnUNKwQmtD5JZPty7XRMg3lDVjFZD0C04yJot4V7C\n\t1AALPDZnECP2pg=="
        ],
        "X-ME-Sender": "<xms:sALgWVjdmdflcz3yntuq5S9eB8oMt1sPMtBvq3NoH40Qif5sYwJ8vw>",
        "From": "Thomas Monjalon <thomas@monjalon.net>",
        "To": "gowrishankar.m@linux.vnet.ibm.com, jerin.jacob@caviumnetworks.com,\n\tjianbo.liu@linaro.org, sergio.gonzalez.monroy@intel.com,\n\tbruce.richardson@intel.com",
        "Cc": "dev@dpdk.org",
        "Date": "Fri, 13 Oct 2017 02:02:47 +0200",
        "Message-Id": "<20171013000247.4158-5-thomas@monjalon.net>",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": "<20171013000247.4158-1-thomas@monjalon.net>",
        "References": "<cover.1506058385.git.gowrishankar.m@linux.vnet.ibm.com>\n\t<20171013000247.4158-1-thomas@monjalon.net>",
        "Subject": "[dpdk-dev] [PATCH 4/4] eal/x86: implement arch-specific TSC freq\n\tquery",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>\n\nFirst, try to use CPUID Time Stamp Counter and Nominal Core Crystal\nClock Information Leaf to determine the tsc hz on platforms that\nsupports it (does not require privileged user).\n\nIf the CPUID leaf is not available, then try to determine the tsc hz by\nreading the MSR 0xCE (requires privileged user).\n\nDefault to the tsc hz estimation if both methods fail.\n\nSigned-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>\nAcked-by: Harry van Haaren <harry.van.haaren@intel.com>\nTested-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n lib/librte_eal/common/arch/x86/rte_cycles.c | 142 +++++++++++++++++++++++++++-\n 1 file changed, 141 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/librte_eal/common/arch/x86/rte_cycles.c b/lib/librte_eal/common/arch/x86/rte_cycles.c\nindex 851fd0255..1049d6567 100644\n--- a/lib/librte_eal/common/arch/x86/rte_cycles.c\n+++ b/lib/librte_eal/common/arch/x86/rte_cycles.c\n@@ -1,7 +1,147 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <fcntl.h>\n+#include <unistd.h>\n+#include <cpuid.h>\n+\n #include \"eal_private.h\"\n \n+static unsigned int\n+rte_cpu_get_model(uint32_t fam_mod_step)\n+{\n+\tuint32_t family, model, ext_model;\n+\n+\tfamily = (fam_mod_step >> 8) & 0xf;\n+\tmodel = (fam_mod_step >> 4) & 0xf;\n+\n+\tif (family == 6 || family == 15) {\n+\t\text_model = (fam_mod_step >> 16) & 0xf;\n+\t\tmodel += (ext_model << 4);\n+\t}\n+\n+\treturn model;\n+}\n+\n+static int32_t\n+rdmsr(int msr, uint64_t *val)\n+{\n+#ifdef RTE_EXEC_ENV_LINUXAPP\n+\tint fd;\n+\tint ret;\n+\n+\tfd = open(\"/dev/cpu/0/msr\", O_RDONLY);\n+\tif (fd < 0)\n+\t\treturn fd;\n+\n+\tret = pread(fd, val, sizeof(uint64_t), msr);\n+\n+\tclose(fd);\n+\n+\treturn ret;\n+#else\n+\treturn -1;\n+#endif\n+}\n+\n+static uint32_t\n+check_model_wsm_nhm(uint8_t model)\n+{\n+\tswitch (model) {\n+\t/* Westmere */\n+\tcase 0x25:\n+\tcase 0x2C:\n+\tcase 0x2F:\n+\t/* Nehalem */\n+\tcase 0x1E:\n+\tcase 0x1F:\n+\tcase 0x1A:\n+\tcase 0x2E:\n+\t\treturn 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static uint32_t\n+check_model_gdm_dnv(uint8_t model)\n+{\n+\tswitch (model) {\n+\t/* Goldmont */\n+\tcase 0x5C:\n+\t/* Denverton */\n+\tcase 0x5F:\n+\t\treturn 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n uint64_t\n get_tsc_freq_arch(void)\n {\n-\treturn 0;\n+\tuint64_t tsc_hz = 0;\n+\tuint32_t a, b, c, d, maxleaf;\n+\tuint8_t mult, model;\n+\tint32_t ret;\n+\n+\t/*\n+\t * Time Stamp Counter and Nominal Core Crystal Clock\n+\t * Information Leaf\n+\t */\n+\tmaxleaf = __get_cpuid_max(0, NULL);\n+\n+\tif (maxleaf >= 0x15) {\n+\t\t__cpuid(0x15, a, b, c, d);\n+\n+\t\t/* EBX : TSC/Crystal ratio, ECX : Crystal Hz */\n+\t\tif (b && c)\n+\t\t\treturn c * (b / a);\n+\t}\n+\n+\t__cpuid(0x1, a, b, c, d);\n+\tmodel = rte_cpu_get_model(a);\n+\n+\tif (check_model_wsm_nhm(model))\n+\t\tmult = 133;\n+\telse if ((c & bit_AVX) || check_model_gdm_dnv(model))\n+\t\tmult = 100;\n+\telse\n+\t\treturn 0;\n+\n+\tret = rdmsr(0xCE, &tsc_hz);\n+\tif (ret < 0)\n+\t\treturn 0;\n+\n+\treturn ((tsc_hz >> 8) & 0xff) * mult * 1E6;\n }\n",
    "prefixes": [
        "dpdk-dev",
        "4/4"
    ]
}