get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 98541,
    "url": "http://patches.dpdk.org/api/patches/98541/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210910130548.127017-3-miao.li@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": "<20210910130548.127017-3-miao.li@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210910130548.127017-3-miao.li@intel.com",
    "date": "2021-09-10T13:05:45",
    "name": "[2/5] lib/vhost: implement rte_power_monitor API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "42e81ebca88f230f3c7bc8a22a70fd45508b23a4",
    "submitter": {
        "id": 2220,
        "url": "http://patches.dpdk.org/api/people/2220/?format=api",
        "name": "Li, Miao",
        "email": "miao.li@intel.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210910130548.127017-3-miao.li@intel.com/mbox/",
    "series": [
        {
            "id": 18818,
            "url": "http://patches.dpdk.org/api/series/18818/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18818",
            "date": "2021-09-10T13:05:43",
            "name": "CPU Enabling: Implement rte_power_monitor API in virtio/vhost PMD",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/18818/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/98541/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/98541/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 84B94A0547;\n\tFri, 10 Sep 2021 07:04:00 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id EF609410F5;\n\tFri, 10 Sep 2021 07:03:53 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by mails.dpdk.org (Postfix) with ESMTP id 2F230410E8\n for <dev@dpdk.org>; Fri, 10 Sep 2021 07:03:52 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 09 Sep 2021 22:03:51 -0700",
            "from limiao-icelake.sh.intel.com ([10.67.115.199])\n by fmsmga002.fm.intel.com with ESMTP; 09 Sep 2021 22:03:50 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10102\"; a=\"208102005\"",
            "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"208102005\"",
            "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"549003920\""
        ],
        "X-ExtLoop1": "1",
        "From": "Miao Li <miao.li@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "chenbo.xia@intel.com,\n\tmaxime.coquelin@redhat.com,\n\tmiao.li@intel.com",
        "Date": "Fri, 10 Sep 2021 13:05:45 +0000",
        "Message-Id": "<20210910130548.127017-3-miao.li@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210910130548.127017-1-miao.li@intel.com>",
        "References": "<20210910130548.127017-1-miao.li@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 2/5] lib/vhost: implement rte_power_monitor API",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "This patch defines rte_vhost_power_monitor_cond which is used to pass\nsome information to vhost driver. The information is including the address\nto monitor, the expected value, the mask to extract value read from 'addr',\nthe flag used to distinguish packed ring or split ring. Vhost driver can\nuse these information to fill rte_power_monitor_cond.\n\nSigned-off-by: Miao Li <miao.li@intel.com>\n---\n lib/vhost/rte_vhost.h | 33 +++++++++++++++++++++++++++++++++\n lib/vhost/version.map |  3 +++\n lib/vhost/vhost.c     | 30 ++++++++++++++++++++++++++++++\n 3 files changed, 66 insertions(+)",
    "diff": "diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h\nindex 8d875e9322..f58643b0a3 100644\n--- a/lib/vhost/rte_vhost.h\n+++ b/lib/vhost/rte_vhost.h\n@@ -38,6 +38,8 @@ extern \"C\" {\n #define RTE_VHOST_USER_ASYNC_COPY\t(1ULL << 7)\n #define RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS\t(1ULL << 8)\n \n+#define VHOST_POWER_MONITOR_RING_PACKED (1ULL << 0)\n+\n /* Features. */\n #ifndef VIRTIO_NET_F_GUEST_ANNOUNCE\n  #define VIRTIO_NET_F_GUEST_ANNOUNCE 21\n@@ -292,6 +294,20 @@ struct vhost_device_ops {\n \tvoid *reserved[1]; /**< Reserved for future extension */\n };\n \n+/**\n+ * Power monitor condition.\n+ */\n+struct rte_vhost_power_monitor_cond {\n+\tvolatile void *addr;  /**< Address to monitor for changes */\n+\t/**< If the `mask` is non-zero, location pointed\n+\t *   to by `addr` will be read and compared\n+\t *   against this value.\n+\t */\n+\tuint64_t val;\n+\tuint64_t mask; /**< 64-bit mask to extract value read from `addr` */\n+\tuint8_t flag;  /**< if 1, vhost packed ring, otherwise split ring */\n+};\n+\n /**\n  * Convert guest physical address to host virtual address\n  *\n@@ -914,6 +930,23 @@ int rte_vhost_vring_call(int vid, uint16_t vring_idx);\n  */\n uint32_t rte_vhost_rx_queue_count(int vid, uint16_t qid);\n \n+/**\n+ * Get power monitor address of the vhost device\n+ *\n+ * @param vid\n+ *  vhost device ID\n+ * @param queue_id\n+ *  vhost queue ID\n+ * @param pmc\n+ *  power monitor condition\n+ * @return\n+ *  0 on success, -1 on failure\n+ */\n+__rte_experimental\n+int\n+rte_vhost_get_monitor_addr(int vid, uint16_t queue_id,\n+\t\tstruct rte_vhost_power_monitor_cond *pmc);\n+\n /**\n  * Get log base and log size of the vhost device\n  *\ndiff --git a/lib/vhost/version.map b/lib/vhost/version.map\nindex c92a9d4962..0a9667ef1e 100644\n--- a/lib/vhost/version.map\n+++ b/lib/vhost/version.map\n@@ -85,4 +85,7 @@ EXPERIMENTAL {\n \trte_vhost_async_channel_register_thread_unsafe;\n \trte_vhost_async_channel_unregister_thread_unsafe;\n \trte_vhost_clear_queue_thread_unsafe;\n+\n+\t# added in 21.11\n+\trte_vhost_get_monitor_addr;\n };\ndiff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c\nindex 355ff37651..f7374d3f94 100644\n--- a/lib/vhost/vhost.c\n+++ b/lib/vhost/vhost.c\n@@ -1886,5 +1886,35 @@ int rte_vhost_async_get_inflight(int vid, uint16_t queue_id)\n \treturn ret;\n }\n \n+int\n+rte_vhost_get_monitor_addr(int vid, uint16_t queue_id,\n+\t\tstruct rte_vhost_power_monitor_cond *pmc)\n+{\n+\tstruct virtio_net *dev = get_device(vid);\n+\tstruct vhost_virtqueue *vq = dev->virtqueue[queue_id];\n+\tif (vq == NULL)\n+\t\treturn -1;\n+\tif (vq_is_packed(dev)) {\n+\t\tstruct vring_packed_desc *desc;\n+\t\tdesc = vq->desc_packed;\n+\t\tpmc->addr = &desc[vq->last_avail_idx].flags;\n+\t\tif (vq->avail_wrap_counter)\n+\t\t\tpmc->val = VRING_DESC_F_AVAIL;\n+\t\telse\n+\t\t\tpmc->val = VRING_DESC_F_USED;\n+\t\tpmc->mask = VRING_DESC_F_AVAIL | VRING_DESC_F_USED;\n+\t\tpmc->flag = VHOST_POWER_MONITOR_RING_PACKED;\n+\t} else {\n+\t\tpmc->addr = &vq->avail->idx;\n+\t\tpmc->val = vq->last_avail_idx & (vq->size - 1);\n+\t\tpmc->mask = vq->size - 1;\n+\t\tpmc->flag = 0;\n+\t}\n+\tif (pmc->addr == NULL)\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n RTE_LOG_REGISTER_SUFFIX(vhost_config_log_level, config, INFO);\n RTE_LOG_REGISTER_SUFFIX(vhost_data_log_level, data, WARNING);\n",
    "prefixes": [
        "2/5"
    ]
}