get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 55471,
    "url": "http://patches.dpdk.org/api/patches/55471/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190627104055.8244-8-bruce.richardson@intel.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": "<20190627104055.8244-8-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190627104055.8244-8-bruce.richardson@intel.com",
    "date": "2019-06-27T10:40:54",
    "name": "[v3,7/8] raw/ioat: add statistics functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ae308c9c7f149b271617d06e9dda23b2c8fe970b",
    "submitter": {
        "id": 20,
        "url": "http://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.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/20190627104055.8244-8-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 5195,
            "url": "http://patches.dpdk.org/api/series/5195/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5195",
            "date": "2019-06-27T10:40:47",
            "name": "raw/ioat: driver for Intel QuickData Technology",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/5195/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/55471/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/55471/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 0AC644C6C;\n\tThu, 27 Jun 2019 12:41:24 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 247C9378E\n\tfor <dev@dpdk.org>; Thu, 27 Jun 2019 12:41:16 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Jun 2019 03:41:16 -0700",
            "from silpixa00399126.ir.intel.com (HELO\n\tsilpixa00399126.ger.corp.intel.com) ([10.237.223.2])\n\tby orsmga008.jf.intel.com with ESMTP; 27 Jun 2019 03:41:15 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.63,423,1557212400\"; d=\"scan'208\";a=\"156198754\"",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, jerinj@marvell.com,\n\tBruce Richardson <bruce.richardson@intel.com>",
        "Date": "Thu, 27 Jun 2019 11:40:54 +0100",
        "Message-Id": "<20190627104055.8244-8-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190627104055.8244-1-bruce.richardson@intel.com>",
        "References": "<20190530212525.40370-1-bruce.richardson@intel.com>\n\t<20190627104055.8244-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 7/8] raw/ioat: add statistics functions",
        "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 stats functions to track what is happening in the driver, and put\nunit tests to check those.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n\nV2: test cases moved to self-test routine\n---\n doc/guides/rawdevs/ioat_rawdev.rst  | 14 +++++++++\n drivers/raw/ioat/ioat_rawdev.c      | 44 +++++++++++++++++++++++++++++\n drivers/raw/ioat/ioat_rawdev_test.c | 39 +++++++++++++++++++++++++\n drivers/raw/ioat/rte_ioat_rawdev.h  |  6 ++++\n 4 files changed, 103 insertions(+)",
    "diff": "diff --git a/doc/guides/rawdevs/ioat_rawdev.rst b/doc/guides/rawdevs/ioat_rawdev.rst\nindex 9ab97e2aa..b908f31e0 100644\n--- a/doc/guides/rawdevs/ioat_rawdev.rst\n+++ b/doc/guides/rawdevs/ioat_rawdev.rst\n@@ -149,3 +149,17 @@ The following code shows how the device is configured in\n \n Once configured, the device can then be made ready for use by calling the\n ``rte_rawdev_start()`` API.\n+\n+Querying Device Statistics\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+The statistics from the IOAT rawdev device can be got via the xstats\n+functions in the ``rte_rawdev`` library, i.e.\n+``rte_rawdev_xstats_names_get()``, ``rte_rawdev_xstats_get()`` and\n+``rte_rawdev_xstats_by_name_get``. The statistics returned for each device\n+instance are:\n+\n+* ``failed_enqueues``\n+* ``successful_enqueues``\n+* ``copies_started``\n+* ``copies_completed``\ndiff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c\nindex fd1653da2..0dde0e820 100644\n--- a/drivers/raw/ioat/ioat_rawdev.c\n+++ b/drivers/raw/ioat/ioat_rawdev.c\n@@ -4,6 +4,7 @@\n \n #include <rte_cycles.h>\n #include <rte_bus_pci.h>\n+#include <rte_string_fns.h>\n #include <rte_rawdev_pmd.h>\n \n #include \"rte_ioat_rawdev.h\"\n@@ -106,6 +107,47 @@ ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)\n \t\tcfg->ring_size = ioat->ring_size;\n }\n \n+static const char * const xstat_names[] = {\n+\t\t\"failed_enqueues\", \"successful_enqueues\",\n+\t\t\"copies_started\", \"copies_completed\"\n+};\n+\n+static int\n+ioat_xstats_get(const struct rte_rawdev *dev, const unsigned int ids[],\n+\t\tuint64_t values[], unsigned int n)\n+{\n+\tconst struct rte_ioat_rawdev *ioat = dev->dev_private;\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < n; i++) {\n+\t\tswitch (ids[i]) {\n+\t\tcase 0: values[i] = ioat->enqueue_failed; break;\n+\t\tcase 1: values[i] = ioat->enqueued; break;\n+\t\tcase 2: values[i] = ioat->started; break;\n+\t\tcase 3: values[i] = ioat->completed; break;\n+\t\tdefault: values[i] = 0; break;\n+\t\t}\n+\t}\n+\treturn n;\n+}\n+\n+static int\n+ioat_xstats_get_names(const struct rte_rawdev *dev,\n+\t\tstruct rte_rawdev_xstats_name *names,\n+\t\tunsigned int size)\n+{\n+\tunsigned int i;\n+\n+\tRTE_SET_USED(dev);\n+\tif (size < RTE_DIM(xstat_names))\n+\t\treturn RTE_DIM(xstat_names);\n+\n+\tfor (i = 0; i < RTE_DIM(xstat_names); i++)\n+\t\tstrlcpy(names[i].name, xstat_names[i], sizeof(names[i]));\n+\n+\treturn RTE_DIM(xstat_names);\n+}\n+\n int ioat_rawdev_test(uint16_t dev_id);\n \n static int\n@@ -116,6 +158,8 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)\n \t\t\t.dev_start = ioat_dev_start,\n \t\t\t.dev_stop = ioat_dev_stop,\n \t\t\t.dev_info_get = ioat_dev_info_get,\n+\t\t\t.xstats_get = ioat_xstats_get,\n+\t\t\t.xstats_get_names = ioat_xstats_get_names,\n \t\t\t.dev_selftest = ioat_rawdev_test,\n \t};\n \ndiff --git a/drivers/raw/ioat/ioat_rawdev_test.c b/drivers/raw/ioat/ioat_rawdev_test.c\nindex 5375da26c..5098d71ae 100644\n--- a/drivers/raw/ioat/ioat_rawdev_test.c\n+++ b/drivers/raw/ioat/ioat_rawdev_test.c\n@@ -2,6 +2,7 @@\n  * Copyright(c) 2019 Intel Corporation\n  */\n \n+#include <inttypes.h>\n #include \"rte_rawdev.h\"\n #include \"rte_ioat_rawdev.h\"\n \n@@ -13,6 +14,11 @@ ioat_rawdev_test(uint16_t dev_id)\n #define IOAT_TEST_RINGSIZE 512\n \tstruct rte_ioat_rawdev_config p = { .ring_size = -1 };\n \tstruct rte_rawdev_info info = { .dev_private = &p };\n+\tstruct rte_rawdev_xstats_name *snames = NULL;\n+\tuint64_t *stats = NULL;\n+\tunsigned int *ids = NULL;\n+\tunsigned int nb_xstats;\n+\tunsigned int i;\n \n \trte_rawdev_info_get(dev_id, &info);\n \tif (p.ring_size != 0) {\n@@ -37,5 +43,38 @@ ioat_rawdev_test(uint16_t dev_id)\n \t\tprintf(\"Error with rte_rawdev_start()\\n\");\n \t\treturn -1;\n \t}\n+\n+\t/* allocate memory for xstats names and values */\n+\tnb_xstats = rte_rawdev_xstats_names_get(dev_id, NULL, 0);\n+\n+\tsnames = malloc(sizeof(*snames) * nb_xstats);\n+\tif (snames == NULL) {\n+\t\tprintf(\"Error allocating xstat names memory\\n\");\n+\t\treturn -1;\n+\t}\n+\trte_rawdev_xstats_names_get(dev_id, snames, nb_xstats);\n+\n+\tids = malloc(sizeof(*ids) * nb_xstats);\n+\tif (ids == NULL) {\n+\t\tprintf(\"Error allocating xstat ids memory\\n\");\n+\t\treturn -1;\n+\t}\n+\tfor (i = 0; i < nb_xstats; i++)\n+\t\tids[i] = i;\n+\n+\tstats = malloc(sizeof(*stats) * nb_xstats);\n+\tif (stats == NULL) {\n+\t\tprintf(\"Error allocating xstat memory\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\trte_rawdev_xstats_get(dev_id, ids, stats, nb_xstats);\n+\tfor (i = 0; i < nb_xstats; i++)\n+\t\tprintf(\"%s: %\"PRIu64\"   \", snames[i].name, stats[i]);\n+\tprintf(\"\\n\");\n+\n+\tfree(snames);\n+\tfree(stats);\n+\tfree(ids);\n \treturn 0;\n }\ndiff --git a/drivers/raw/ioat/rte_ioat_rawdev.h b/drivers/raw/ioat/rte_ioat_rawdev.h\nindex c09fd0791..aa534f9cf 100644\n--- a/drivers/raw/ioat/rte_ioat_rawdev.h\n+++ b/drivers/raw/ioat/rte_ioat_rawdev.h\n@@ -50,6 +50,12 @@ struct rte_ioat_rawdev {\n \tstruct rte_ioat_generic_hw_desc *desc_ring;\n \t__m128i *hdls; /* completion handles for returning to user */\n \n+\t/* some statistics for tracking, if added/changed update xstats fns*/\n+\tuint64_t enqueue_failed __rte_cache_aligned;\n+\tuint64_t enqueued;\n+\tuint64_t started;\n+\tuint64_t completed;\n+\n \t/* to report completions, the device will write status back here */\n \tvolatile uint64_t status __rte_cache_aligned;\n };\n",
    "prefixes": [
        "v3",
        "7/8"
    ]
}