get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 75840,
    "url": "http://patches.dpdk.org/api/patches/75840/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200821162944.29840-16-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": "<20200821162944.29840-16-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200821162944.29840-16-bruce.richardson@intel.com",
    "date": "2020-08-21T16:29:41",
    "name": "[v2,15/18] 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/20200821162944.29840-16-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 11744,
            "url": "http://patches.dpdk.org/api/series/11744/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11744",
            "date": "2020-08-21T16:29:26",
            "name": "raw/ioat: enhancements and new hardware support",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/11744/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/75840/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/75840/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 552C1A04AF;\n\tFri, 21 Aug 2020 18:32:57 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8F5701C1A4;\n\tFri, 21 Aug 2020 18:30:46 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id 692831C1A1\n for <dev@dpdk.org>; Fri, 21 Aug 2020 18:30:44 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Aug 2020 09:30:43 -0700",
            "from silpixa00399126.ir.intel.com ([10.237.222.56])\n by orsmga006.jf.intel.com with ESMTP; 21 Aug 2020 09:30:42 -0700"
        ],
        "IronPort-SDR": [
            "\n pRgM9i1GKjr5qMfKOIdB3P7/44M1ZI8mV8i31wFEMNeuAEck69By5yHQ5dzq3yk5JjVVhG57+J\n vfB9fO/IYZ6g==",
            "\n nV0x8ptVFLdDreX0SJSeAIJyhJsm9tgdEuXkTrM9igNh/w0jYV4RTnuj/MmZEsJ1+/zgJHM89l\n AiVcn4nkNo2g=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9719\"; a=\"173615938\"",
            "E=Sophos;i=\"5.76,337,1592895600\"; d=\"scan'208\";a=\"173615938\"",
            "E=Sophos;i=\"5.76,337,1592895600\"; d=\"scan'208\";a=\"297992962\""
        ],
        "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": "cheng1.jiang@intel.com, patrick.fu@intel.com, ping.yu@intel.com,\n kevin.laatz@intel.com, Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Fri, 21 Aug 2020 17:29:41 +0100",
        "Message-Id": "<20200821162944.29840-16-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200821162944.29840-1-bruce.richardson@intel.com>",
        "References": "<20200721095140.719297-1-bruce.richardson@intel.com>\n <20200821162944.29840-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 15/18] 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>\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 15133737b9..064eb839cf 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 19aaaa50c8..66e3f1a836 100644\n--- a/drivers/raw/ioat/rte_ioat_rawdev_fns.h\n+++ b/drivers/raw/ioat/rte_ioat_rawdev_fns.h\n@@ -47,17 +47,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@@ -70,12 +84,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@@ -207,7 +215,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@@ -226,7 +234,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@@ -241,7 +249,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@@ -307,7 +315,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": [
        "v2",
        "15/18"
    ]
}