get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 118268,
    "url": "https://patches.dpdk.org/api/patches/118268/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1666006905-74029-8-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": "<1666006905-74029-8-git-send-email-andy.pei@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1666006905-74029-8-git-send-email-andy.pei@intel.com",
    "date": "2022-10-17T11:41:44",
    "name": "[v6,7/8] vhost: vDPA blk device gets ready when the first queue is ready",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "df463e743e4570a5ae7b319aec4d0fd92df99343",
    "submitter": {
        "id": 1185,
        "url": "https://patches.dpdk.org/api/people/1185/?format=api",
        "name": "Pei, Andy",
        "email": "andy.pei@intel.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/1666006905-74029-8-git-send-email-andy.pei@intel.com/mbox/",
    "series": [
        {
            "id": 25258,
            "url": "https://patches.dpdk.org/api/series/25258/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=25258",
            "date": "2022-10-17T11:41:37",
            "name": "vdpa/ifc: add multi queue support",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/25258/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/118268/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/118268/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 2871CA055F;\n\tMon, 17 Oct 2022 13:46:21 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 32A3D427F7;\n\tMon, 17 Oct 2022 13:45:55 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 69E1A40143\n for <dev@dpdk.org>; Mon, 17 Oct 2022 13:45:53 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Oct 2022 04:45:52 -0700",
            "from dpdk-dipei.sh.intel.com ([10.67.110.251])\n by orsmga007.jf.intel.com with ESMTP; 17 Oct 2022 04:45:50 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1666007153; x=1697543153;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=2E8rWV4Ob8VP4vWbcKSKcf6H2fjNUbXFqrtkzhfIPnc=;\n b=SmebgpbYpZgKJo0wXupn8qZ/ryHBWjNOVT+J4xz5IJVcoDmAFYpcFB+2\n hPOffs1dhyGctIXzK5216uZlVDJ604+OjzFh9GcRFhRW8FWSXoYPSAfbx\n cB42QoaMfE3Zy260crCvRncEMQcJDeDcvyoRKzRO1AEQ5MuKMc9l3671c\n nh1DPlmdmoiqIN7+gjrkSYi3MAJJZdayPIh/EdyKBUxklOUW+eWAZHH9M\n zGKZrTRKjPKA1V/6cAP20/bInFK4WF28yKbd4ymyp5XzLsYvObxAphkcv\n 6NnqGnXTxTWgPO6iTTxwGZ+T6mVhZSiHIV5ZZ1nZsIf5RjXwKrUzHhrJ0 Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10502\"; a=\"305763853\"",
            "E=Sophos;i=\"5.95,191,1661842800\"; d=\"scan'208\";a=\"305763853\"",
            "E=McAfee;i=\"6500,9779,10502\"; a=\"623199972\"",
            "E=Sophos;i=\"5.95,191,1661842800\"; d=\"scan'208\";a=\"623199972\""
        ],
        "X-ExtLoop1": "1",
        "From": "Andy Pei <andy.pei@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "chenbo.xia@intel.com, rosen.xu@intel.com, wei.huang@intel.com,\n gang.cao@intel.com, maxime.coquelin@redhat.com",
        "Subject": "[PATCH v6 7/8] vhost: vDPA blk device gets ready when the first queue\n is ready",
        "Date": "Mon, 17 Oct 2022 19:41:44 +0800",
        "Message-Id": "<1666006905-74029-8-git-send-email-andy.pei@intel.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1666006905-74029-1-git-send-email-andy.pei@intel.com>",
        "References": "<1661229305-240952-2-git-send-email-andy.pei@intel.com>\n <1666006905-74029-1-git-send-email-andy.pei@intel.com>",
        "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"
    },
    "content": "When boot from virtio blk device, seabios in QEMU only enables one queue.\nTo work in this scenario, vDPA BLK device back-end configure device\nwhen any queue is ready.\nAdd vdpa_device_type to rte_vdpa_device to store vDPA device type.\n\nSigned-off-by: Andy Pei <andy.pei@intel.com>\nSigned-off-by: Huang Wei <wei.huang@intel.com>\n---\n lib/vhost/vdpa_driver.h |  2 ++\n lib/vhost/vhost_user.c  | 55 ++++++++++++++++++++++++++++++++++---------------\n 2 files changed, 40 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h\nindex 8b88a53..c4ec222 100644\n--- a/lib/vhost/vdpa_driver.h\n+++ b/lib/vhost/vdpa_driver.h\n@@ -92,6 +92,8 @@ struct rte_vdpa_device {\n \tstruct rte_device *device;\n \t/** vdpa device operations */\n \tstruct rte_vdpa_dev_ops *ops;\n+\t/** vdpa device type: net, blk... */\n+\tuint32_t vdpa_device_type;\n };\n \n /**\ndiff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c\nindex cd65257..53806fa 100644\n--- a/lib/vhost/vhost_user.c\n+++ b/lib/vhost/vhost_user.c\n@@ -1441,11 +1441,14 @@\n }\n \n #define VIRTIO_BUILTIN_NUM_VQS_TO_BE_READY 2u\n+#define VIRTIO_BLK_NUM_VQS_TO_BE_READY 1u\n \n static int\n virtio_is_ready(struct virtio_net *dev)\n {\n+\tstruct rte_vdpa_device *vdpa_dev;\n \tstruct vhost_virtqueue *vq;\n+\tuint32_t vdpa_type;\n \tuint32_t i, nr_vring = dev->nr_vring;\n \n \tif (dev->flags & VIRTIO_DEV_READY)\n@@ -1454,13 +1457,22 @@\n \tif (!dev->nr_vring)\n \t\treturn 0;\n \n-\tif (dev->flags & VIRTIO_DEV_BUILTIN_VIRTIO_NET) {\n-\t\tnr_vring = VIRTIO_BUILTIN_NUM_VQS_TO_BE_READY;\n+\tvdpa_dev = dev->vdpa_dev;\n+\tif (vdpa_dev)\n+\t\tvdpa_type = vdpa_dev->vdpa_device_type;\n+\telse\n+\t\tvdpa_type = -1;\n \n-\t\tif (dev->nr_vring < nr_vring)\n-\t\t\treturn 0;\n+\tif (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK) {\n+\t\tnr_vring = VIRTIO_BLK_NUM_VQS_TO_BE_READY;\n+\t} else {\n+\t\tif (dev->flags & VIRTIO_DEV_BUILTIN_VIRTIO_NET)\n+\t\t\tnr_vring = VIRTIO_BUILTIN_NUM_VQS_TO_BE_READY;\n \t}\n \n+\tif (dev->nr_vring < nr_vring)\n+\t\treturn 0;\n+\n \tfor (i = 0; i < nr_vring; i++) {\n \t\tvq = dev->virtqueue[i];\n \n@@ -2958,7 +2970,7 @@ static int is_vring_iotlb(struct virtio_net *dev,\n \tint ret;\n \tint unlock_required = 0;\n \tbool handled;\n-\tuint32_t vdpa_type = 0;\n+\tuint32_t vdpa_type = -1;\n \tuint32_t request;\n \tuint32_t i;\n \n@@ -3152,7 +3164,27 @@ static int is_vring_iotlb(struct virtio_net *dev,\n \tif (unlock_required)\n \t\tvhost_user_unlock_all_queue_pairs(dev);\n \n-\tif (ret != 0 || !virtio_is_ready(dev))\n+\tif (ret != 0)\n+\t\tgoto out;\n+\n+\tvdpa_dev = dev->vdpa_dev;\n+\tif (vdpa_dev) {\n+\t\tif (vdpa_dev->ops->get_dev_type) {\n+\t\t\tret = vdpa_dev->ops->get_dev_type(vdpa_dev, &vdpa_type);\n+\t\t\tif (ret) {\n+\t\t\t\tVHOST_LOG_CONFIG(dev->ifname, ERR,\n+\t\t\t\t\t\"failed to get vdpa dev type.\\n\");\n+\t\t\t\tret = -1;\n+\t\t\t\tgoto out;\n+\t\t\t}\n+\t\t} else {\n+\t\t\tvdpa_type = RTE_VHOST_VDPA_DEVICE_TYPE_NET;\n+\t\t}\n+\n+\t\tvdpa_dev->vdpa_device_type = vdpa_type;\n+\t}\n+\n+\tif (!virtio_is_ready(dev))\n \t\tgoto out;\n \n \t/*\n@@ -3166,20 +3198,9 @@ static int is_vring_iotlb(struct virtio_net *dev,\n \t\t\tdev->flags |= VIRTIO_DEV_RUNNING;\n \t}\n \n-\tvdpa_dev = dev->vdpa_dev;\n \tif (!vdpa_dev)\n \t\tgoto out;\n \n-\tif (vdpa_dev->ops->get_dev_type) {\n-\t\tret = vdpa_dev->ops->get_dev_type(vdpa_dev, &vdpa_type);\n-\t\tif (ret) {\n-\t\t\tVHOST_LOG_CONFIG(dev->ifname, ERR, \"failed to get vdpa dev type.\\n\");\n-\t\t\tret = -1;\n-\t\t\tgoto out;\n-\t\t}\n-\t} else {\n-\t\tvdpa_type = RTE_VHOST_VDPA_DEVICE_TYPE_NET;\n-\t}\n \tif (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK\n \t\t&& request != VHOST_USER_SET_VRING_CALL)\n \t\tgoto out;\n",
    "prefixes": [
        "v6",
        "7/8"
    ]
}