get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 69768,
    "url": "https://patches.dpdk.org/api/patches/69768/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1588694084-381748-2-git-send-email-matan@mellanox.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1588694084-381748-2-git-send-email-matan@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1588694084-381748-2-git-send-email-matan@mellanox.com",
    "date": "2020-05-05T15:54:41",
    "name": "[v2,1/4] vhost: inroduce operation to get vDPA queue stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a96210fd0e1e321c854deea240365ed4771092b5",
    "submitter": {
        "id": 796,
        "url": "https://patches.dpdk.org/api/people/796/?format=api",
        "name": "Matan Azrad",
        "email": "matan@mellanox.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1588694084-381748-2-git-send-email-matan@mellanox.com/mbox/",
    "series": [
        {
            "id": 9839,
            "url": "https://patches.dpdk.org/api/series/9839/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9839",
            "date": "2020-05-05T15:54:40",
            "name": "vhost: support vDPA virtio queue statistics",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/9839/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/69768/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/69768/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 072D6A04B8;\n\tTue,  5 May 2020 17:55:09 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E51241D64F;\n\tTue,  5 May 2020 17:55:08 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id CD8B31D628\n for <dev@dpdk.org>; Tue,  5 May 2020 17:55:07 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n matan@mellanox.com)\n with ESMTPS (AES256-SHA encrypted); 5 May 2020 18:55:01 +0300",
            "from pegasus25.mtr.labs.mlnx. (pegasus25.mtr.labs.mlnx\n [10.210.16.10])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 045Fstgl022938;\n Tue, 5 May 2020 18:55:01 +0300"
        ],
        "From": "Matan Azrad <matan@mellanox.com>",
        "To": "dev@dpdk.org",
        "Cc": "Viacheslav Ovsiienko <viacheslavo@mellanox.com>,\n Shahaf Shuler <shahafs@mellanox.com>,\n Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Tue,  5 May 2020 15:54:41 +0000",
        "Message-Id": "<1588694084-381748-2-git-send-email-matan@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1588694084-381748-1-git-send-email-matan@mellanox.com>",
        "References": "<1585826793-28709-1-git-send-email-matan@mellanox.com>\n <1588694084-381748-1-git-send-email-matan@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v2 1/4] vhost: inroduce operation to get vDPA\n\tqueue stats",
        "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": "The vDPA device offloads all the datapath of the vhost device to the HW\ndevice.\n\nIn order to expose to the user traffic information this patch\nintroduces new 3 APIs to get traffic statistics, the device statistics\nname and to reset the statistics per virtio queue.\n\nThe statistics are taken directly from the vDPA driver managing the HW\ndevice and can be different for each vendor driver.\n\nSigned-off-by: Matan Azrad <matan@mellanox.com>\n---\n doc/guides/rel_notes/release_20_05.rst    |   5 ++\n doc/guides/vdpadevs/features/default.ini  |   1 +\n doc/guides/vdpadevs/features_overview.rst |   3 +\n lib/librte_vhost/rte_vdpa.h               | 115 +++++++++++++++++++++++++++++-\n lib/librte_vhost/rte_vhost_version.map    |   3 +\n lib/librte_vhost/vdpa.c                   |  47 ++++++++++++\n 6 files changed, 173 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst\nindex a5ba8a4..b7d8e86 100644\n--- a/doc/guides/rel_notes/release_20_05.rst\n+++ b/doc/guides/rel_notes/release_20_05.rst\n@@ -213,6 +213,11 @@ New Features\n   * Added IPsec inbound load-distribution support for ipsec-secgw application\n     using NIC load distribution feature(Flow Director).\n \n+* **Added vDPA device APIs to query virtio queue statistics.**\n+\n+  A new 3 APIs has been added to query virtio queue statistics, to get their\n+  names and to reset them by a vDPA device.\n+\n \n Removed Items\n -------------\ndiff --git a/doc/guides/vdpadevs/features/default.ini b/doc/guides/vdpadevs/features/default.ini\nindex 518e4f1..2c122a3 100644\n--- a/doc/guides/vdpadevs/features/default.ini\n+++ b/doc/guides/vdpadevs/features/default.ini\n@@ -37,6 +37,7 @@ proto rarp           =\n proto reply ack      =\n proto host notifier  =\n proto pagefault      =\n+queue statistics     =\n BSD nic_uio          =\n Linux VFIO           =\n Other kdrv           =\ndiff --git a/doc/guides/vdpadevs/features_overview.rst b/doc/guides/vdpadevs/features_overview.rst\nindex eb7eb3b..930bc87 100644\n--- a/doc/guides/vdpadevs/features_overview.rst\n+++ b/doc/guides/vdpadevs/features_overview.rst\n@@ -96,6 +96,9 @@ proto host notifier\n proto pagefault\n   Slave expose page-fault FD for migration process.\n \n+queue statistics\n+  Support virtio queue statistics query.\n+\n BSD nic_uio\n   BSD ``nic_uio`` module supported.\n \ndiff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h\nindex 3c400ee..ecb3d91 100644\n--- a/lib/librte_vhost/rte_vdpa.h\n+++ b/lib/librte_vhost/rte_vdpa.h\n@@ -37,6 +37,34 @@ struct rte_vdpa_dev_addr {\n \t};\n };\n \n+/** Maximum name length for statistics counters */\n+#define RTE_VDPA_STATS_NAME_SIZE 64\n+\n+/**\n+ * A vDPA device statistic structure\n+ *\n+ * This structure is used by rte_vdpa_stats_get() to provide\n+ * statistics from the HW vDPA device.\n+ *\n+ * It maps a name id, corresponding to an index in the array returned\n+ * by rte_vdpa_get_stats_names, to a statistic value.\n+ */\n+struct rte_vdpa_stat {\n+\tuint64_t id;        /**< The index in stats name array */\n+\tuint64_t value;     /**< The statistic counter value */\n+};\n+\n+/**\n+ * A name element for statistics\n+ *\n+ * An array of this structure is returned by rte_vdpa_get_stats_names\n+ * It lists the names of extended statistics for a PMD. The rte_vdpa_stat\n+ * structure references these names by their array index\n+ */\n+struct rte_vdpa_stat_name {\n+\tchar name[RTE_VDPA_STATS_NAME_SIZE]; /**< The statistic name */\n+};\n+\n /**\n  * vdpa device operations\n  */\n@@ -73,8 +101,19 @@ struct rte_vdpa_dev_ops {\n \tint (*get_notify_area)(int vid, int qid,\n \t\t\tuint64_t *offset, uint64_t *size);\n \n+\t/** Get statistics name */\n+\tint (*get_stats_names)(int did, struct rte_vdpa_stat_name *stats_names,\n+\t\t\t       unsigned int size);\n+\n+\t/** Get statistics of the queue */\n+\tint (*get_stats)(int did, int qid, struct rte_vdpa_stat *stats,\n+\t\t\t unsigned int n);\n+\n+\t/** Reset statistics of the queue */\n+\tint (*reset_stats)(int did, int qid);\n+\n \t/** Reserved for future extension */\n-\tvoid *reserved[5];\n+\tvoid *reserved[2];\n };\n \n /**\n@@ -200,4 +239,78 @@ struct rte_vdpa_device *\n __rte_experimental\n int\n rte_vdpa_relay_vring_used(int vid, uint16_t qid, void *vring_m);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Retrieve names of statistics of a vDPA device.\n+ *\n+ * There is an assumption that 'stat_names' and 'stats' arrays are matched\n+ * by array index: stats_names[i].name => stats[i].value\n+ *\n+ * And the array index is same with id field of 'struct rte_vdpa_stat':\n+ * stats[i].id == i\n+ *\n+ * @param did\n+ *  device id\n+ * @param stats_names\n+ *   array of at least size elements to be filled.\n+ *   If set to NULL, the function returns the required number of elements.\n+ * @param size\n+ *   The number of elements in stats_names array.\n+ * @return\n+ *   A negative value on error, otherwise the number of entries filled in the\n+ *   stats name array.\n+ */\n+__rte_experimental\n+int\n+rte_vdpa_get_stats_names(int did, struct rte_vdpa_stat_name *stats_names,\n+\t\t\t unsigned int size);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Retrieve statistics of a vDPA device.\n+ *\n+ * There is an assumption that 'stat_names' and 'stats' arrays are matched\n+ * by array index: stats_names[i].name => stats[i].value\n+ *\n+ * And the array index is same with id field of 'struct rte_vdpa_stat':\n+ * stats[i].id == i\n+ *\n+ * @param did\n+ *  device id\n+ * @param qid\n+ *  queue id\n+ * @param stats\n+ *   A pointer to a table of structure of type rte_vdpa_stat to be filled with\n+ *   device statistics ids and values.\n+ * @param n\n+ *   The number of elements in stats array.\n+ * @return\n+ *   A negative value on error, otherwise the number of entries filled in the\n+ *   stats table.\n+ */\n+__rte_experimental\n+int\n+rte_vdpa_get_stats(int did, uint16_t qid, struct rte_vdpa_stat *stats,\n+\t\t   unsigned int n);\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Reset statistics of a vDPA device.\n+ *\n+ * @param did\n+ *  device id\n+ * @param qid\n+ *  queue id\n+ * @return\n+ *   0 on success, a negative value on error.\n+ */\n+__rte_experimental\n+int\n+rte_vdpa_reset_stats(int did, uint16_t qid);\n #endif /* _RTE_VDPA_H_ */\ndiff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rte_vhost_version.map\nindex 051d08c..3a2f7df 100644\n--- a/lib/librte_vhost/rte_vhost_version.map\n+++ b/lib/librte_vhost/rte_vhost_version.map\n@@ -38,6 +38,9 @@ EXPERIMENTAL {\n \trte_vdpa_find_device_id;\n \trte_vdpa_get_device;\n \trte_vdpa_get_device_num;\n+\trte_vdpa_get_stats_names;\n+\trte_vdpa_get_stats;\n+\trte_vdpa_reset_stats;\n \trte_vhost_driver_attach_vdpa_device;\n \trte_vhost_driver_detach_vdpa_device;\n \trte_vhost_driver_get_vdpa_device_id;\ndiff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c\nindex b2b2a10..1f5cdcd 100644\n--- a/lib/librte_vhost/vdpa.c\n+++ b/lib/librte_vhost/vdpa.c\n@@ -227,3 +227,50 @@ struct rte_vdpa_device *\n \t\tfree_ind_table(idesc);\n \treturn -1;\n }\n+\n+int\n+rte_vdpa_get_stats_names(int did, struct rte_vdpa_stat_name *stats_names,\n+\t\t\t unsigned int size)\n+{\n+\tstruct rte_vdpa_device *vdpa_dev;\n+\n+\tvdpa_dev = rte_vdpa_get_device(did);\n+\tif (!vdpa_dev)\n+\t\treturn -ENODEV;\n+\n+\tRTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_stats_names, -ENOTSUP);\n+\n+\treturn vdpa_dev->ops->get_stats_names(did, stats_names, size);\n+}\n+\n+int\n+rte_vdpa_get_stats(int did, uint16_t qid, struct rte_vdpa_stat *stats,\n+\t\t   unsigned int n)\n+{\n+\tstruct rte_vdpa_device *vdpa_dev;\n+\n+\tvdpa_dev = rte_vdpa_get_device(did);\n+\tif (!vdpa_dev)\n+\t\treturn -ENODEV;\n+\n+\tif (!stats || !n)\n+\t\treturn -EINVAL;\n+\n+\tRTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_stats, -ENOTSUP);\n+\n+\treturn vdpa_dev->ops->get_stats(did, qid, stats, n);\n+}\n+\n+int\n+rte_vdpa_reset_stats(int did, uint16_t qid)\n+{\n+\tstruct rte_vdpa_device *vdpa_dev;\n+\n+\tvdpa_dev = rte_vdpa_get_device(did);\n+\tif (!vdpa_dev)\n+\t\treturn -ENODEV;\n+\n+\tRTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->reset_stats, -ENOTSUP);\n+\n+\treturn vdpa_dev->ops->reset_stats(did, qid);\n+}\n",
    "prefixes": [
        "v2",
        "1/4"
    ]
}