get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 79044,
    "url": "http://patches.dpdk.org/api/patches/79044/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200928164245.84997-22-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": "<20200928164245.84997-22-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200928164245.84997-22-bruce.richardson@intel.com",
    "date": "2020-09-28T16:42:41",
    "name": "[v4,21/25] raw/ioat: create separate statistics structure",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "330c4b43060d9a6061974144946ec98d5b4fc522",
    "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/20200928164245.84997-22-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 12560,
            "url": "http://patches.dpdk.org/api/series/12560/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12560",
            "date": "2020-09-28T16:42:20",
            "name": "raw/ioat: enhancements and new hardware support",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/12560/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/79044/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/79044/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 2F1F1A04DB;\n\tMon, 28 Sep 2020 18:50:31 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 957751D9EE;\n\tMon, 28 Sep 2020 18:43:49 +0200 (CEST)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n by dpdk.org (Postfix) with ESMTP id E35811D5D1\n for <dev@dpdk.org>; Mon, 28 Sep 2020 18:43:40 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Sep 2020 09:43:40 -0700",
            "from silpixa00399126.ir.intel.com ([10.237.222.4])\n by fmsmga004.fm.intel.com with ESMTP; 28 Sep 2020 09:43:38 -0700"
        ],
        "IronPort-SDR": [
            "\n ZoK0+k4kkBVWbAaCDuCGUA5gKXiyO3tNUCQuY4krlyLB/0I7SMFenvB+El6tkcEnmBlS4gpWxI\n IBiTy713mycw==",
            "\n QhNj1EOUz+rVx8olHBnIxnYjESuGRURhB7DwWEW8YPeWMvX6CpOatDxYHrudBR+j1g/c59ZX7n\n rzxBMvzXEwQw=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9758\"; a=\"223619928\"",
            "E=Sophos;i=\"5.77,313,1596524400\"; d=\"scan'208\";a=\"223619928\"",
            "E=Sophos;i=\"5.77,313,1596524400\"; d=\"scan'208\";a=\"338250655\""
        ],
        "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": "patrick.fu@intel.com, Bruce Richardson <bruce.richardson@intel.com>,\n Kevin Laatz <kevin.laatz@intel.com>",
        "Date": "Mon, 28 Sep 2020 17:42:41 +0100",
        "Message-Id": "<20200928164245.84997-22-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200928164245.84997-1-bruce.richardson@intel.com>",
        "References": "<20200721095140.719297-1-bruce.richardson@intel.com>\n <20200928164245.84997-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v4 21/25] raw/ioat: create separate statistics\n\tstructure",
        "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": "Rather than having the xstats as fields inside the main driver structure,\ncreate a separate structure type for them.\n\nAs part of the change, when updating the stats functions referring to the\nstats by the old path, we can simplify them to use the id to directly index\ninto the stats structure, making the code shorter and simpler.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\nReviewed-by: Kevin Laatz <kevin.laatz@intel.com>\n---\n drivers/raw/ioat/ioat_rawdev.c         | 40 +++++++-------------------\n drivers/raw/ioat/rte_ioat_rawdev_fns.h | 30 ++++++++++++-------\n 2 files changed, 29 insertions(+), 41 deletions(-)",
    "diff": "diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c\nindex 0097be87ee..4ea913fff1 100644\n--- a/drivers/raw/ioat/ioat_rawdev.c\n+++ b/drivers/raw/ioat/ioat_rawdev.c\n@@ -132,16 +132,14 @@ 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+\tconst uint64_t *stats = (const void *)&ioat->xstats;\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\tif (ids[i] < sizeof(ioat->xstats)/sizeof(*stats))\n+\t\t\tvalues[i] = stats[ids[i]];\n+\t\telse\n+\t\t\tvalues[i] = 0;\n \t}\n \treturn n;\n }\n@@ -167,35 +165,17 @@ static int\n ioat_xstats_reset(struct rte_rawdev *dev, const uint32_t *ids, uint32_t nb_ids)\n {\n \tstruct rte_ioat_rawdev *ioat = dev->dev_private;\n+\tuint64_t *stats = (void *)&ioat->xstats;\n \tunsigned int i;\n \n \tif (!ids) {\n-\t\tioat->enqueue_failed = 0;\n-\t\tioat->enqueued = 0;\n-\t\tioat->started = 0;\n-\t\tioat->completed = 0;\n+\t\tmemset(&ioat->xstats, 0, sizeof(ioat->xstats));\n \t\treturn 0;\n \t}\n \n-\tfor (i = 0; i < nb_ids; i++) {\n-\t\tswitch (ids[i]) {\n-\t\tcase 0:\n-\t\t\tioat->enqueue_failed = 0;\n-\t\t\tbreak;\n-\t\tcase 1:\n-\t\t\tioat->enqueued = 0;\n-\t\t\tbreak;\n-\t\tcase 2:\n-\t\t\tioat->started = 0;\n-\t\t\tbreak;\n-\t\tcase 3:\n-\t\t\tioat->completed = 0;\n-\t\t\tbreak;\n-\t\tdefault:\n-\t\t\tIOAT_PMD_WARN(\"Invalid xstat id - cannot reset value\");\n-\t\t\tbreak;\n-\t\t}\n-\t}\n+\tfor (i = 0; i < nb_ids; i++)\n+\t\tif (ids[i] < sizeof(ioat->xstats)/sizeof(*stats))\n+\t\t\tstats[ids[i]] = 0;\n \n \treturn 0;\n }\ndiff --git a/drivers/raw/ioat/rte_ioat_rawdev_fns.h b/drivers/raw/ioat/rte_ioat_rawdev_fns.h\nindex 36ba876eab..89bfc8d21a 100644\n--- a/drivers/raw/ioat/rte_ioat_rawdev_fns.h\n+++ b/drivers/raw/ioat/rte_ioat_rawdev_fns.h\n@@ -49,17 +49,31 @@ enum rte_ioat_dev_type {\n \tRTE_IDXD_DEV,\n };\n \n+/**\n+ * @internal\n+ * some statistics for tracking, if added/changed update xstats fns\n+ */\n+struct rte_ioat_xstats {\n+\tuint64_t enqueue_failed;\n+\tuint64_t enqueued;\n+\tuint64_t started;\n+\tuint64_t completed;\n+};\n+\n /**\n  * @internal\n  * Structure representing an IOAT device instance\n  */\n struct rte_ioat_rawdev {\n+\t/* common fields at the top - match those in rte_idxd_rawdev */\n \tenum rte_ioat_dev_type type;\n+\tstruct rte_ioat_xstats xstats;\n+\n \tstruct rte_rawdev *rawdev;\n \tconst struct rte_memzone *mz;\n \tconst struct rte_memzone *desc_mz;\n \n-\tvolatile uint16_t *doorbell;\n+\tvolatile uint16_t *doorbell __rte_cache_aligned;\n \tphys_addr_t status_addr;\n \tphys_addr_t ring_addr;\n \n@@ -72,12 +86,6 @@ struct rte_ioat_rawdev {\n \tunsigned short next_read;\n \tunsigned short next_write;\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@@ -209,7 +217,7 @@ __ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,\n \tstruct rte_ioat_generic_hw_desc *desc;\n \n \tif (space == 0) {\n-\t\tioat->enqueue_failed++;\n+\t\tioat->xstats.enqueue_failed++;\n \t\treturn 0;\n \t}\n \n@@ -228,7 +236,7 @@ __ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,\n \t\t\t\t\t(int64_t)src_hdl);\n \trte_prefetch0(&ioat->desc_ring[ioat->next_write & mask]);\n \n-\tioat->enqueued++;\n+\tioat->xstats.enqueued++;\n \treturn 1;\n }\n \n@@ -261,7 +269,7 @@ __ioat_perform_ops(int dev_id)\n \t\t\t.control.completion_update = 1;\n \trte_compiler_barrier();\n \t*ioat->doorbell = ioat->next_write;\n-\tioat->started = ioat->enqueued;\n+\tioat->xstats.started = ioat->xstats.enqueued;\n }\n \n /**\n@@ -328,7 +336,7 @@ __ioat_completed_ops(int dev_id, uint8_t max_copies,\n \n end:\n \tioat->next_read = read;\n-\tioat->completed += count;\n+\tioat->xstats.completed += count;\n \treturn count;\n }\n \n",
    "prefixes": [
        "v4",
        "21/25"
    ]
}