get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 72803,
    "url": "https://patches.dpdk.org/api/patches/72803/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200702083237.1215652-7-amorenoz@redhat.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": "<20200702083237.1215652-7-amorenoz@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200702083237.1215652-7-amorenoz@redhat.com",
    "date": "2020-07-02T08:32:35",
    "name": "[v2,6/8] vhost: add support for virtio get status message",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9a47654b0ad85726938f1b6ca32bfa11ae5047a9",
    "submitter": {
        "id": 1397,
        "url": "https://patches.dpdk.org/api/people/1397/?format=api",
        "name": "Adrian Moreno",
        "email": "amorenoz@redhat.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/20200702083237.1215652-7-amorenoz@redhat.com/mbox/",
    "series": [
        {
            "id": 10732,
            "url": "https://patches.dpdk.org/api/series/10732/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10732",
            "date": "2020-07-02T08:32:30",
            "name": "vhost: improve Vhost/vDPA device init",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/10732/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/72803/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/72803/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 E3707A0524;\n\tThu,  2 Jul 2020 10:34:00 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CB5631D727;\n\tThu,  2 Jul 2020 10:33:18 +0200 (CEST)",
            "from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com\n [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id D0DE21D727\n for <dev@dpdk.org>; Thu,  2 Jul 2020 10:33:16 +0200 (CEST)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-295-ylOm4nNnM6-uED_cNTi9yw-1; Thu, 02 Jul 2020 04:33:15 -0400",
            "from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com\n [10.5.11.22])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CF7F8014D7;\n Thu,  2 Jul 2020 08:33:13 +0000 (UTC)",
            "from amorenoz.users.ipa.redhat.com (ovpn-112-91.ams2.redhat.com\n [10.36.112.91])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 6DB8910027A6;\n Thu,  2 Jul 2020 08:33:08 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1593678796;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=HKe4YbY95C6CjDp22RPtM+c8/GhVdt/UFQ4k9s8V0Dk=;\n b=X4jBnq6OO9pG9EfcMjFHUjzzvERQ8cWNtSfZg2zfnsAFqqQazW6Ngfq7xzYLdnJBJNJ9JC\n +5lWnjPWZppVFcksK7BEw66kWYhuQlsUCE3/U2tTxyGOBia5r2pi69byn8rSlopDQJqVVA\n XQXid5Ae/nnlFehvqP+Yx26b8gdkOkw=",
        "X-MC-Unique": "ylOm4nNnM6-uED_cNTi9yw-1",
        "From": "Adrian Moreno <amorenoz@redhat.com>",
        "To": "dev@dpdk.org, xiaolong.ye@intel.com, shahafs@mellanox.com,\n matan@mellanox.com, maxime.coquelin@redhat.com, xiao.w.wang@intel.com,\n viacheslavo@mellanox.com",
        "Cc": "jasowang@redhat.com, lulu@redhat.com, Adrian Moreno <amorenoz@redhat.com>",
        "Date": "Thu,  2 Jul 2020 10:32:35 +0200",
        "Message-Id": "<20200702083237.1215652-7-amorenoz@redhat.com>",
        "In-Reply-To": "<20200702083237.1215652-1-amorenoz@redhat.com>",
        "References": "<20200702083237.1215652-1-amorenoz@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.84 on 10.5.11.22",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@redhat.com",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=US-ASCII",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 6/8] vhost: add support for virtio get status\n\tmessage",
        "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": "This patch adds support to the new Virtio device get status\nVhost-user message.\n\nThe driver can send this new message to read the device status.\n\nOne of the uses of this message is to ensure the feature negotiation has\nsucceded.  According to the virtio spec, after completing the feature\nnegotiation, the driver sets the FEATURE_OK status bit and re-reads it\nto ensure the device has accepted the features.\n\nThis patch also clears the FEATURE_OK status bit if the feature\nnegotiation has failed to let the driver know about his failure.\n\nSigned-off-by: Adrian Moreno <amorenoz@redhat.com>\n---\n lib/librte_vhost/vhost.h      |  2 ++\n lib/librte_vhost/vhost_user.c | 32 ++++++++++++++++++++++++++++++++\n lib/librte_vhost/vhost_user.h |  1 +\n 3 files changed, 35 insertions(+)",
    "diff": "diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex 25d31c71b..e743821cc 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -32,6 +32,8 @@\n #define VIRTIO_DEV_BUILTIN_VIRTIO_NET 4\n /* Used to indicate that the device has its own data path and configured */\n #define VIRTIO_DEV_VDPA_CONFIGURED 8\n+/* Used to indicate that the feature negotiation failed */\n+#define VIRTIO_DEV_FEATURES_FAILED 16\n \n /* Backend value set by guest. */\n #define VIRTIO_DEV_STOPPED -1\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex 8d3d13913..00da7bf18 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -88,6 +88,7 @@ static const char *vhost_message_str[VHOST_USER_MAX] = {\n \t[VHOST_USER_GET_INFLIGHT_FD] = \"VHOST_USER_GET_INFLIGHT_FD\",\n \t[VHOST_USER_SET_INFLIGHT_FD] = \"VHOST_USER_SET_INFLIGHT_FD\",\n \t[VHOST_USER_SET_STATUS] = \"VHOST_USER_SET_STATUS\",\n+\t[VHOST_USER_GET_STATUS] = \"VHOST_USER_GET_STATUS\",\n };\n \n static int send_vhost_reply(int sockfd, struct VhostUserMsg *msg);\n@@ -339,6 +340,9 @@ vhost_user_set_features(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"(%d) received invalid negotiated features.\\n\",\n \t\t\tdev->vid);\n+\t\tdev->flags |= VIRTIO_DEV_FEATURES_FAILED;\n+\t\tdev->status &= ~VIRTIO_DEVICE_STATUS_FEATURES_OK;\n+\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \n@@ -402,6 +406,7 @@ vhost_user_set_features(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \tif (vdpa_dev)\n \t\tvdpa_dev->ops->set_features(dev->vid);\n \n+\tdev->flags &= ~VIRTIO_DEV_FEATURES_FAILED;\n \treturn RTE_VHOST_MSG_RESULT_OK;\n }\n \n@@ -2458,6 +2463,22 @@ vhost_user_postcopy_end(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n }\n \n+static int\n+vhost_user_get_status(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+\t\t      int main_fd __rte_unused)\n+{\n+\tstruct virtio_net *dev = *pdev;\n+\n+\tif (validate_msg_fds(msg, 0) != 0)\n+\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n+\n+\tmsg->payload.u64 = dev->status;\n+\tmsg->size = sizeof(msg->payload.u64);\n+\tmsg->fd_num = 0;\n+\n+\treturn RTE_VHOST_MSG_RESULT_OK;\n+}\n+\n static int\n vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t\t\tint main_fd __rte_unused)\n@@ -2476,6 +2497,16 @@ vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \n \tdev->status = msg->payload.u64;\n \n+\tif ((dev->status & VIRTIO_DEVICE_STATUS_FEATURES_OK) &&\n+\t    (dev->flags & VIRTIO_DEV_FEATURES_FAILED)) {\n+\t\tVHOST_LOG_CONFIG(ERR, \"FEATURES_OK bit is set but feature negotiation failed\\n\");\n+\t\t/*\n+\t\t * Clear the bit to let the driver know about the feature\n+\t\t * negotiation failure\n+\t\t */\n+\t\tdev->status &= ~VIRTIO_DEVICE_STATUS_FEATURES_OK;\n+\t    }\n+\n \tVHOST_LOG_CONFIG(INFO, \"New device status(0x%08x):\\n\"\n \t\t\t\"\\t-ACKNOWLEDGE: %u\\n\"\n \t\t\t\"\\t-DRIVER: %u\\n\"\n@@ -2527,6 +2558,7 @@ static vhost_message_handler_t vhost_message_handlers[VHOST_USER_MAX] = {\n \t[VHOST_USER_GET_INFLIGHT_FD] = vhost_user_get_inflight_fd,\n \t[VHOST_USER_SET_INFLIGHT_FD] = vhost_user_set_inflight_fd,\n \t[VHOST_USER_SET_STATUS] = vhost_user_set_status,\n+\t[VHOST_USER_GET_STATUS] = vhost_user_get_status,\n };\n \n /* return bytes# of read on success or negative val on failure. */\ndiff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h\nindex 82885ab5e..16fe03f88 100644\n--- a/lib/librte_vhost/vhost_user.h\n+++ b/lib/librte_vhost/vhost_user.h\n@@ -58,6 +58,7 @@ typedef enum VhostUserRequest {\n \tVHOST_USER_GET_INFLIGHT_FD = 31,\n \tVHOST_USER_SET_INFLIGHT_FD = 32,\n \tVHOST_USER_SET_STATUS = 39,\n+\tVHOST_USER_GET_STATUS = 40,\n \tVHOST_USER_MAX = 41\n } VhostUserRequest;\n \n",
    "prefixes": [
        "v2",
        "6/8"
    ]
}