get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 59324,
    "url": "https://patches.dpdk.org/api/patches/59324/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1568711388-257817-2-git-send-email-andy.pei@intel.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": "<1568711388-257817-2-git-send-email-andy.pei@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1568711388-257817-2-git-send-email-andy.pei@intel.com",
    "date": "2019-09-17T09:09:47",
    "name": "[v2,2/3] vhost: call vDPA callback at the end of vring enable handler",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "e528a172a992bebf44126bfc062d0f0c7a33b4d3",
    "submitter": {
        "id": 1185,
        "url": "https://patches.dpdk.org/api/people/1185/?format=api",
        "name": "Pei, Andy",
        "email": "andy.pei@intel.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1568711388-257817-2-git-send-email-andy.pei@intel.com/mbox/",
    "series": [
        {
            "id": 6424,
            "url": "https://patches.dpdk.org/api/series/6424/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6424",
            "date": "2019-09-17T09:09:46",
            "name": "[v2,1/3] net/ifcvf: add multiqueue configuration",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/6424/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/59324/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/59324/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 6FC6D1C06B;\n\tTue, 17 Sep 2019 11:23:57 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id 5E7D71C069\n\tfor <dev@dpdk.org>; Tue, 17 Sep 2019 11:23:55 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t17 Sep 2019 02:23:55 -0700",
            "from dpdk-dipei.sh.intel.com ([10.67.110.224])\n\tby fmsmga006.fm.intel.com with ESMTP; 17 Sep 2019 02:23:53 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.64,515,1559545200\"; d=\"scan'208\";a=\"387501548\"",
        "From": "Andy Pei <andy.pei@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "rosen.xu@intel.com, xiaolong.ye@intel.com, tiwei.bie@intel.com,\n\txiao.w.wang@intel.com",
        "Date": "Tue, 17 Sep 2019 17:09:47 +0800",
        "Message-Id": "<1568711388-257817-2-git-send-email-andy.pei@intel.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1568711388-257817-1-git-send-email-andy.pei@intel.com>",
        "References": "<1568711388-257817-1-git-send-email-andy.pei@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 2/3] vhost: call vDPA callback at the end of\n\tvring enable handler",
        "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": "vDPA's set_vring_state callback would need to know the virtqueues'\nenable status to configure the hardware.\n\nSigned-off-by: Xiaolong Ye <xiaolong.ye@intel.com>\nSigned-off-by: Andy Pei <andy.pei@intel.com>\n---\nv2:\n add nr_active_vring as a parameter to ops function set_vring_state in\n case of callback in set_vring_state() and avoid exposing new API.\n\n lib/librte_vhost/rte_vdpa.h   |  4 ++--\n lib/librte_vhost/vhost_user.c | 27 +++++++++++++++++++++++++--\n 2 files changed, 27 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h\nindex 9a3deb3..6e55d4d 100644\n--- a/lib/librte_vhost/rte_vdpa.h\n+++ b/lib/librte_vhost/rte_vdpa.h\n@@ -54,8 +54,8 @@ struct rte_vdpa_dev_ops {\n \tint (*dev_conf)(int vid);\n \tint (*dev_close)(int vid);\n \n-\t/** Enable/disable this vring */\n-\tint (*set_vring_state)(int vid, int vring, int state);\n+\t/** Enable/disable vring queue pairs */\n+\tint (*set_vring_state)(int vid, int nr_active_vring);\n \n \t/** Set features when changed */\n \tint (*set_features)(int vid);\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex 0b72648..4d7de44 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -1325,6 +1325,25 @@ static int vhost_user_set_vring_err(struct virtio_net **pdev __rte_unused,\n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n }\n \n+static uint16_t\n+vhost_get_active_vring_num(int vid)\n+{\n+\tstruct virtio_net *dev = get_device(vid);\n+\tstruct vhost_virtqueue *vq;\n+\tuint16_t qid;\n+\n+\tif (dev == NULL)\n+\t\treturn 0;\n+\n+\tfor (qid = 0; qid < dev->nr_vring; qid++) {\n+\t\tvq = dev->virtqueue[qid];\n+\t\tif (!vq->enabled)\n+\t\t\tbreak;\n+\t}\n+\n+\treturn qid;\n+}\n+\n /*\n  * when virtio queues are ready to work, qemu will send us to\n  * enable the virtio queue pair.\n@@ -1339,6 +1358,7 @@ static int vhost_user_set_vring_err(struct virtio_net **pdev __rte_unused,\n \tint index = (int)msg->payload.state.index;\n \tstruct rte_vdpa_device *vdpa_dev;\n \tint did = -1;\n+\tint nr_active_vring;\n \n \tRTE_LOG(INFO, VHOST_CONFIG,\n \t\t\"set queue enable: %d to qp idx: %d\\n\",\n@@ -1346,8 +1366,6 @@ static int vhost_user_set_vring_err(struct virtio_net **pdev __rte_unused,\n \n \tdid = dev->vdpa_dev_id;\n \tvdpa_dev = rte_vdpa_get_device(did);\n-\tif (vdpa_dev && vdpa_dev->ops->set_vring_state)\n-\t\tvdpa_dev->ops->set_vring_state(dev->vid, index, enable);\n \n \tif (dev->notify_ops->vring_state_changed)\n \t\tdev->notify_ops->vring_state_changed(dev->vid,\n@@ -1359,6 +1377,11 @@ static int vhost_user_set_vring_err(struct virtio_net **pdev __rte_unused,\n \n \tdev->virtqueue[index]->enabled = enable;\n \n+\tif (vdpa_dev && vdpa_dev->ops->set_vring_state) {\n+\t\tnr_active_vring = vhost_get_active_vring_num(dev->vid);\n+\t\tvdpa_dev->ops->set_vring_state(dev->vid, nr_active_vring);\n+\t}\n+\n \treturn RTE_VHOST_MSG_RESULT_OK;\n }\n \n",
    "prefixes": [
        "v2",
        "2/3"
    ]
}