get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 53934,
    "url": "http://patches.dpdk.org/api/patches/53934/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190530212525.40370-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": "<20190530212525.40370-8-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190530212525.40370-8-bruce.richardson@intel.com",
    "date": "2019-05-30T21:25:24",
    "name": "[7/8] raw/ioat: add statistics functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b28b2e56769b68d7f0a234852a5d386cb2472aae",
    "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/20190530212525.40370-8-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 4831,
            "url": "http://patches.dpdk.org/api/series/4831/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4831",
            "date": "2019-05-30T21:25:17",
            "name": "raw/ioat: driver for Intel QuickData Technology",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4831/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/53934/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/53934/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 07A1B1B995;\n\tThu, 30 May 2019 23:26:06 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 488781B952\n\tfor <dev@dpdk.org>; Thu, 30 May 2019 23:25:55 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 May 2019 14:25:54 -0700",
            "from silpixa00399126.ir.intel.com (HELO\n\tsilpixa00399126.ger.corp.intel.com) ([10.237.223.2])\n\tby orsmga001.jf.intel.com with ESMTP; 30 May 2019 14:25:54 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Thu, 30 May 2019 22:25:24 +0100",
        "Message-Id": "<20190530212525.40370-8-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190530212525.40370-1-bruce.richardson@intel.com>",
        "References": "<20190530212525.40370-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 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 app/test/test_ioat_rawdev.c        | 38 ++++++++++++++++++++++++++\n doc/guides/rawdevs/ioat_rawdev.rst | 14 ++++++++++\n drivers/raw/ioat/ioat_rawdev.c     | 44 ++++++++++++++++++++++++++++++\n drivers/raw/ioat/rte_ioat_rawdev.h |  6 ++++\n 4 files changed, 102 insertions(+)",
    "diff": "diff --git a/app/test/test_ioat_rawdev.c b/app/test/test_ioat_rawdev.c\nindex 36e97347c..7081f3365 100644\n--- a/app/test/test_ioat_rawdev.c\n+++ b/app/test/test_ioat_rawdev.c\n@@ -24,6 +24,11 @@ run_ioat_tests(int 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@@ -48,6 +53,39 @@ run_ioat_tests(int 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 }\n \ndiff --git a/doc/guides/rawdevs/ioat_rawdev.rst b/doc/guides/rawdevs/ioat_rawdev.rst\nindex b3fe79033..47f12e95c 100644\n--- a/doc/guides/rawdevs/ioat_rawdev.rst\n+++ b/doc/guides/rawdevs/ioat_rawdev.rst\n@@ -111,3 +111,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 b4b70a1e6..09fbdbf9c 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 *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 static int\n ioat_rawdev_create(const char *name, struct rte_pci_device *dev)\n {\n@@ -114,6 +156,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};\n \n \tstruct rte_rawdev *rawdev = NULL;\ndiff --git a/drivers/raw/ioat/rte_ioat_rawdev.h b/drivers/raw/ioat/rte_ioat_rawdev.h\nindex 7eab216c8..abe5ba298 100644\n--- a/drivers/raw/ioat/rte_ioat_rawdev.h\n+++ b/drivers/raw/ioat/rte_ioat_rawdev.h\n@@ -49,6 +49,12 @@ struct rte_ioat_rawdev {\n \tstruct rte_ioat_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": [
        "7/8"
    ]
}