get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 46544,
    "url": "https://patches.dpdk.org/api/patches/46544/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20181011092432.22275-2-maxime.coquelin@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": "<20181011092432.22275-2-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181011092432.22275-2-maxime.coquelin@redhat.com",
    "date": "2018-10-11T09:24:14",
    "name": "[v6,01/19] vhost: fix messages results handling",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b2e3ba29221a165753c370a91f668c02065c890e",
    "submitter": {
        "id": 512,
        "url": "https://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@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/20181011092432.22275-2-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 1825,
            "url": "https://patches.dpdk.org/api/series/1825/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=1825",
            "date": "2018-10-11T09:24:13",
            "name": "vhost: add postcopy live-migration support",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/1825/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/46544/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/46544/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 9C3491B149;\n\tThu, 11 Oct 2018 11:24:50 +0200 (CEST)",
            "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id F3CE41B126;\n\tThu, 11 Oct 2018 11:24:48 +0200 (CEST)",
            "from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 53095308403A;\n\tThu, 11 Oct 2018 09:24:48 +0000 (UTC)",
            "from localhost.localdomain (ovpn-112-55.ams2.redhat.com\n\t[10.36.112.55])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 25F6660472;\n\tThu, 11 Oct 2018 09:24:44 +0000 (UTC)"
        ],
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com,\n\tjfreimann@redhat.com, nicknickolaev@gmail.com, i.maximets@samsung.com,\n\tbruce.richardson@intel.com, alejandro.lucero@netronome.com",
        "Cc": "dgilbert@redhat.com, stable@dpdk.org,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Thu, 11 Oct 2018 11:24:14 +0200",
        "Message-Id": "<20181011092432.22275-2-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20181011092432.22275-1-maxime.coquelin@redhat.com>",
        "References": "<20181011092432.22275-1-maxime.coquelin@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.11",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.40]); Thu, 11 Oct 2018 09:24:48 +0000 (UTC)",
        "Subject": "[dpdk-dev] [PATCH v6 01/19] vhost: fix messages results handling",
        "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": "Return of message handling has now changed to an enum that can\ntake non-negative value that is not zero in case a reply is\nneeded. But the code checking the variable afterwards has not\nbeen updated, leading to success messages handling being\ntreated as errors.\n\nExternal post and pre callbacks return type needs also to be\nchanged to the new enum, so that its handling is consistent.\nThis is done in this patch alongside with the convertion of\nits only user, vhost-crypto backend.\n\nFixes: 0bff510b5ea6 (\"vhost: unify message handling function signature\")\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/librte_vhost/vhost.h        | 19 +++++++-----------\n lib/librte_vhost/vhost_crypto.c | 24 +++++++++++------------\n lib/librte_vhost/vhost_user.c   | 34 +++++++++------------------------\n lib/librte_vhost/vhost_user.h   |  9 +++++++++\n 4 files changed, 36 insertions(+), 50 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex 25ffd7614..341b0a147 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -292,17 +292,15 @@ struct guest_page {\n  *  vhost device id\n  * @param msg\n  *  Message pointer.\n- * @param require_reply\n- *  If the handler requires sending a reply, this varaible shall be written 1,\n- *  otherwise 0.\n  * @param skip_master\n  *  If the handler requires skipping the master message handling, this variable\n  *  shall be written 1, otherwise 0.\n  * @return\n- *  0 on success, -1 on failure\n+ *  VH_RESULT_OK on success, VH_RESULT_REPLY on success with reply,\n+ *  VH_RESULT_ERR on failure\n  */\n-typedef int (*vhost_msg_pre_handle)(int vid, void *msg,\n-\t\tuint32_t *require_reply, uint32_t *skip_master);\n+typedef enum vh_result (*vhost_msg_pre_handle)(int vid, void *msg,\n+\t\tuint32_t *skip_master);\n \n /**\n  * function prototype for the vhost backend to handler specific vhost user\n@@ -312,14 +310,11 @@ typedef int (*vhost_msg_pre_handle)(int vid, void *msg,\n  *  vhost device id\n  * @param msg\n  *  Message pointer.\n- * @param require_reply\n- *  If the handler requires sending a reply, this varaible shall be written 1,\n- *  otherwise 0.\n  * @return\n- *  0 on success, -1 on failure\n+ *  VH_RESULT_OK on success, VH_RESULT_REPLY on success with reply,\n+ *  VH_RESULT_ERR on failure\n  */\n-typedef int (*vhost_msg_post_handle)(int vid, void *msg,\n-\t\tuint32_t *require_reply);\n+typedef enum vh_result (*vhost_msg_post_handle)(int vid, void *msg);\n \n /**\n  * pre and post vhost user message handlers\ndiff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c\nindex 57341ef8f..e534e1187 100644\n--- a/lib/librte_vhost/vhost_crypto.c\n+++ b/lib/librte_vhost/vhost_crypto.c\n@@ -425,35 +425,33 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)\n \treturn 0;\n }\n \n-static int\n-vhost_crypto_msg_post_handler(int vid, void *msg, uint32_t *require_reply)\n+static enum vh_result\n+vhost_crypto_msg_post_handler(int vid, void *msg)\n {\n \tstruct virtio_net *dev = get_device(vid);\n \tstruct vhost_crypto *vcrypto;\n \tVhostUserMsg *vmsg = msg;\n-\tint ret = 0;\n+\tenum vh_result ret = VH_RESULT_ERR;\n \n-\tif (dev == NULL || require_reply == NULL) {\n+\tif (dev == NULL) {\n \t\tVC_LOG_ERR(\"Invalid vid %i\", vid);\n-\t\treturn -EINVAL;\n+\t\treturn VH_RESULT_ERR;\n \t}\n \n \tvcrypto = dev->extern_data;\n \tif (vcrypto == NULL) {\n \t\tVC_LOG_ERR(\"Cannot find required data, is it initialized?\");\n-\t\treturn -ENOENT;\n+\t\treturn VH_RESULT_ERR;\n \t}\n \n-\t*require_reply = 0;\n-\n \tif (vmsg->request.master == VHOST_USER_CRYPTO_CREATE_SESS) {\n \t\tvhost_crypto_create_sess(vcrypto,\n \t\t\t\t&vmsg->payload.crypto_session);\n-\t\t*require_reply = 1;\n-\t} else if (vmsg->request.master == VHOST_USER_CRYPTO_CLOSE_SESS)\n-\t\tret = vhost_crypto_close_sess(vcrypto, vmsg->payload.u64);\n-\telse\n-\t\tret = -EINVAL;\n+\t\tret = VH_RESULT_REPLY;\n+\t} else if (vmsg->request.master == VHOST_USER_CRYPTO_CLOSE_SESS) {\n+\t\tif (!vhost_crypto_close_sess(vcrypto, vmsg->payload.u64))\n+\t\t\tret = VH_RESULT_OK;\n+\t}\n \n \treturn ret;\n }\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex 7ef3fb4a4..e8375ca34 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -71,16 +71,6 @@ static const char *vhost_message_str[VHOST_USER_MAX] = {\n \t[VHOST_USER_CRYPTO_CLOSE_SESS] = \"VHOST_USER_CRYPTO_CLOSE_SESS\",\n };\n \n-/* The possible results of a message handling function */\n-enum vh_result {\n-\t/* Message handling failed */\n-\tVH_RESULT_ERR   = -1,\n-\t/* Message handling successful */\n-\tVH_RESULT_OK    =  0,\n-\t/* Message handling successful and reply prepared */\n-\tVH_RESULT_REPLY =  1,\n-};\n-\n static uint64_t\n get_blk_size(int fd)\n {\n@@ -1738,14 +1728,11 @@ vhost_user_msg_handler(int vid, int fd)\n \t}\n \n \tif (dev->extern_ops.pre_msg_handle) {\n-\t\tuint32_t need_reply;\n-\n \t\tret = (*dev->extern_ops.pre_msg_handle)(dev->vid,\n-\t\t\t\t(void *)&msg, &need_reply, &skip_master);\n-\t\tif (ret < 0)\n+\t\t\t\t(void *)&msg, &skip_master);\n+\t\tif (ret == VH_RESULT_ERR)\n \t\t\tgoto skip_to_reply;\n-\n-\t\tif (need_reply)\n+\t\telse if (ret == VH_RESULT_REPLY)\n \t\t\tsend_vhost_reply(fd, &msg);\n \n \t\tif (skip_master)\n@@ -1783,15 +1770,12 @@ vhost_user_msg_handler(int vid, int fd)\n \t}\n \n skip_to_post_handle:\n-\tif (!ret && dev->extern_ops.post_msg_handle) {\n-\t\tuint32_t need_reply;\n-\n+\tif (ret != VH_RESULT_ERR && dev->extern_ops.post_msg_handle) {\n \t\tret = (*dev->extern_ops.post_msg_handle)(\n-\t\t\t\tdev->vid, (void *)&msg, &need_reply);\n-\t\tif (ret < 0)\n+\t\t\t\tdev->vid, (void *)&msg);\n+\t\tif (ret == VH_RESULT_ERR)\n \t\t\tgoto skip_to_reply;\n-\n-\t\tif (need_reply)\n+\t\telse if (ret == VH_RESULT_REPLY)\n \t\t\tsend_vhost_reply(fd, &msg);\n \t}\n \n@@ -1800,10 +1784,10 @@ vhost_user_msg_handler(int vid, int fd)\n \t\tvhost_user_unlock_all_queue_pairs(dev);\n \n \tif (msg.flags & VHOST_USER_NEED_REPLY) {\n-\t\tmsg.payload.u64 = !!ret;\n+\t\tmsg.payload.u64 = ret == VH_RESULT_ERR;\n \t\tmsg.size = sizeof(msg.payload.u64);\n \t\tsend_vhost_reply(fd, &msg);\n-\t} else if (ret) {\n+\t} else if (ret == VH_RESULT_ERR) {\n \t\tRTE_LOG(ERR, VHOST_CONFIG,\n \t\t\t\"vhost message handling failed.\\n\");\n \t\treturn -1;\ndiff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h\nindex 42166adf2..62654f736 100644\n--- a/lib/librte_vhost/vhost_user.h\n+++ b/lib/librte_vhost/vhost_user.h\n@@ -139,6 +139,15 @@ typedef struct VhostUserMsg {\n /* The version of the protocol we support */\n #define VHOST_USER_VERSION    0x1\n \n+/* The possible results of a message handling function */\n+enum vh_result {\n+\t/* Message handling failed */\n+\tVH_RESULT_ERR   = -1,\n+\t/* Message handling successful */\n+\tVH_RESULT_OK    =  0,\n+\t/* Message handling successful and reply prepared */\n+\tVH_RESULT_REPLY =  1,\n+};\n \n /* vhost_user.c */\n int vhost_user_msg_handler(int vid, int fd);\n",
    "prefixes": [
        "v6",
        "01/19"
    ]
}