get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 106688,
    "url": "http://patches.dpdk.org/api/patches/106688/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1643425417-215270-7-git-send-email-andy.pei@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": "<1643425417-215270-7-git-send-email-andy.pei@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1643425417-215270-7-git-send-email-andy.pei@intel.com",
    "date": "2022-01-29T03:03:28",
    "name": "[v3,06/15] example/vdpa:add vdpa blk support in example",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "464da01bb48f004aebcff8fe7a9a80ebb0f0ecf8",
    "submitter": {
        "id": 1185,
        "url": "http://patches.dpdk.org/api/people/1185/?format=api",
        "name": "Pei, Andy",
        "email": "andy.pei@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/1643425417-215270-7-git-send-email-andy.pei@intel.com/mbox/",
    "series": [
        {
            "id": 21420,
            "url": "http://patches.dpdk.org/api/series/21420/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=21420",
            "date": "2022-01-29T03:03:22",
            "name": "add virtio_blk device support to vdpa/ifc",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/21420/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/106688/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/106688/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 011ECA00C4;\n\tSat, 29 Jan 2022 04:10:06 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id EC3F7427C4;\n\tSat, 29 Jan 2022 04:09:54 +0100 (CET)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id F35C64279D\n for <dev@dpdk.org>; Sat, 29 Jan 2022 04:09:49 +0100 (CET)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Jan 2022 19:09:49 -0800",
            "from dpdk-dipei.sh.intel.com ([10.67.111.91])\n by fmsmga008.fm.intel.com with ESMTP; 28 Jan 2022 19:09:47 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1643425790; x=1674961790;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=sl1F7F+q6m/30C0lTa30qO79tfeAXta7cCMAWACG5rM=;\n b=SkIIY7rdEt0Rgb6KNUzLHoamvYzZXwCQRZhO+Jh/aovWI5xqBLO8wco9\n XsR4VTID4dne5OhFGCo1kuY4mZKJIedAXfI27wG/QhT09c+h/eOUbfxEq\n d3u5Cl3lHF5CiQlfVJc3IXUlq2Ypiqc/AedV2lzPLyqCQPSP1gwW+n0xC\n WA+3cVqo1qd5s4y3fkgk3tpXAf9MyRlq+8tvM/Fx3J1xEruCdKeehF7MY\n 4SZEbEQ3EwkiW4OkZzyWg6nemiyhDPhjB0z5li5+2hmCAEQfyVGzNhW2z\n jWdcTwMr70RH2AowIIwZQ1SVnq1QNxHZTBaZ39S0B6ioyONGcFs64RfkJ w==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10241\"; a=\"246076620\"",
            "E=Sophos;i=\"5.88,325,1635231600\"; d=\"scan'208\";a=\"246076620\"",
            "E=Sophos;i=\"5.88,325,1635231600\"; d=\"scan'208\";a=\"582047812\""
        ],
        "X-ExtLoop1": "1",
        "From": "Andy Pei <andy.pei@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "chenbo.xia@intel.com, maxime.coquelin@redhat.com, gang.cao@intel.com,\n changpeng.liu@intel.com",
        "Subject": "[PATCH v3 06/15] example/vdpa:add vdpa blk support in example",
        "Date": "Sat, 29 Jan 2022 11:03:28 +0800",
        "Message-Id": "<1643425417-215270-7-git-send-email-andy.pei@intel.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1643425417-215270-1-git-send-email-andy.pei@intel.com>",
        "References": "<1643093258-47258-2-git-send-email-andy.pei@intel.com>\n <1643425417-215270-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": "Add virtio blk device support to vdpa example.\n\nSigned-off-by: Andy Pei <andy.pei@intel.com>\n---\n examples/vdpa/Makefile           |   2 +-\n examples/vdpa/main.c             |   8 ++\n examples/vdpa/meson.build        |   1 +\n examples/vdpa/vdpa_blk_compact.c | 150 +++++++++++++++++++++++++++++++\n examples/vdpa/vdpa_blk_compact.h | 117 ++++++++++++++++++++++++\n examples/vdpa/vhost_user.h       | 189 +++++++++++++++++++++++++++++++++++++++\n 6 files changed, 466 insertions(+), 1 deletion(-)\n create mode 100644 examples/vdpa/vdpa_blk_compact.c\n create mode 100644 examples/vdpa/vdpa_blk_compact.h\n create mode 100644 examples/vdpa/vhost_user.h",
    "diff": "diff --git a/examples/vdpa/Makefile b/examples/vdpa/Makefile\nindex d974db4..9d0479b 100644\n--- a/examples/vdpa/Makefile\n+++ b/examples/vdpa/Makefile\n@@ -5,7 +5,7 @@\n APP = vdpa\n \n # all source are stored in SRCS-y\n-SRCS-y := main.c\n+SRCS-y := main.c vdpa_blk_compact.c\n CFLAGS += -DALLOW_EXPERIMENTAL_API\n \n PKGCONF ?= pkg-config\ndiff --git a/examples/vdpa/main.c b/examples/vdpa/main.c\nindex 5ab0765..924ad7b 100644\n--- a/examples/vdpa/main.c\n+++ b/examples/vdpa/main.c\n@@ -20,6 +20,7 @@\n #include <cmdline_parse_string.h>\n #include <cmdline_parse_num.h>\n #include <cmdline.h>\n+#include \"vdpa_blk_compact.h\"\n \n #define MAX_PATH_LEN 128\n #define MAX_VDPA_SAMPLE_PORTS 1024\n@@ -156,6 +157,7 @@ struct vdpa_port {\n static const struct rte_vhost_device_ops vdpa_sample_devops = {\n \t.new_device = new_device,\n \t.destroy_device = destroy_device,\n+\t.new_connection = rte_vhost_blk_session_install_rte_compat_hooks,\n };\n \n static int\n@@ -192,6 +194,12 @@ struct vdpa_port {\n \t\t\t\"attach vdpa device failed: %s\\n\",\n \t\t\tsocket_path);\n \n+\tif (vdpa_blk_device_set_features_and_protocol(socket_path, vport->dev)\n+\t\t< 0)\n+\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\"set vhost blk driver features and protocol features failed: %s\\n\",\n+\t\t\tsocket_path);\n+\n \tif (rte_vhost_driver_start(socket_path) < 0)\n \t\trte_exit(EXIT_FAILURE,\n \t\t\t\"start vhost driver failed: %s\\n\",\ndiff --git a/examples/vdpa/meson.build b/examples/vdpa/meson.build\nindex bd08605..f0d111c 100644\n--- a/examples/vdpa/meson.build\n+++ b/examples/vdpa/meson.build\n@@ -15,4 +15,5 @@ deps += 'vhost'\n allow_experimental_apis = true\n sources = files(\n         'main.c',\n+\t'vdpa_blk_compact.c',\n )\ndiff --git a/examples/vdpa/vdpa_blk_compact.c b/examples/vdpa/vdpa_blk_compact.c\nnew file mode 100644\nindex 0000000..0c4d3ee\n--- /dev/null\n+++ b/examples/vdpa/vdpa_blk_compact.c\n@@ -0,0 +1,150 @@\n+/*    INTEL CONFIDENTIAL\n+ *\n+ *    Copyright (c) Intel Corporation.\n+ *    All rights reserved.\n+ *\n+ *    The source code contained or described herein and all documents related\n+ *    to the source code (\"Material\") are owned by Intel Corporation or its\n+ *    suppliers or licensors.  Title to the Material remains with Intel\n+ *    Corporation or its suppliers and licensors.  The Material contains trade\n+ *    secrets and proprietary and confidential information of Intel or its\n+ *    suppliers and licensors.  The Material is protected by worldwide\n+ *    copyright and trade secret laws and treaty provisions.  No part of the\n+ *    Material may be used, copied, reproduced, modified, published, uploaded,\n+ *    posted, transmitted, distributed, or disclosed in any way without Intel's\n+ *    prior express written permission.\n+ *\n+ *    No license under any patent, copyright, trade secret or other\n+ *    intellectual property right is granted to or conferred upon you by\n+ *    disclosure or delivery of the Materials, either expressly, by\n+ *    implication, inducement, estoppel or otherwise.  Any license under such\n+ *    intellectual property rights must be express and approved by Intel in\n+ *    writing.\n+ */\n+\n+/* @file\n+ *\n+ * Block device specific vhost lib\n+ */\n+\n+#include <stdbool.h>\n+\n+#include <rte_malloc.h>\n+#include <vdpa_driver.h>\n+#include <rte_vhost.h>\n+#include \"vdpa_blk_compact.h\"\n+#include \"vhost_user.h\"\n+\n+#define VHOST_USER_GET_CONFIG\t24\n+#define VHOST_USER_SET_CONFIG\t25\n+\n+#ifndef VHOST_USER_PROTOCOL_F_CONFIG\n+#define VHOST_USER_PROTOCOL_F_CONFIG   9\n+#endif\n+\n+/*\n+ * Function to handle vhost user blk message\n+ */\n+static enum rte_vhost_msg_result\n+rte_vhost_blk_extern_vhost_pre_msg_handler(int vid, void *_msg)\n+{\n+\tstruct VhostUserMsg *msg = _msg;\n+\tstruct rte_vdpa_device *vdev = NULL;\n+\n+\tvdev = rte_vhost_get_vdpa_device(vid);\n+\tif (vdev == NULL)\n+\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n+\n+\tfprintf(stderr, \"msg is %d\\n\", msg->request.master);\n+\tswitch (msg->request.master) {\n+\tcase VHOST_USER_GET_CONFIG: {\n+\t\tint rc = 0;\n+\n+\t\tfprintf(stdout, \"read message VHOST_USER_GET_CONFIG\\n\");\n+\n+\t\tif (vdev->ops->get_config) {\n+\t\t\tfprintf(stdout, \"get_config() function is valid!\\n\");\n+\t\t\trc = vdev->ops->get_config(vid,\n+\t\t\t\t\t\t   msg->payload.cfg.region,\n+\t\t\t\t\t\t   msg->payload.cfg.size);\n+\t\t\tif (rc != 0) {\n+\t\t\t\tmsg->size = 0;\n+\t\t\t\tfprintf(stdout, \"get_config() return error!\\n\");\n+\t\t\t}\n+\t\t} else {\n+\t\t\tfprintf(stdout, \"get_config() function is invalid!\\n\");\n+\t\t}\n+\n+\t\treturn RTE_VHOST_MSG_RESULT_REPLY;\n+\t}\n+\tcase VHOST_USER_SET_CONFIG: {\n+\t\tint rc = 0;\n+\n+\t\tfprintf(stdout,\n+\t\t\t\"read message VHOST_USER_SET_CONFIG\\n\");\n+\n+\t\tif (vdev->ops->set_config) {\n+\t\t\trc = vdev->ops->set_config(vid,\n+\t\t\t\tmsg->payload.cfg.region,\n+\t\t\t\tmsg->payload.cfg.offset,\n+\t\t\t\tmsg->payload.cfg.size,\n+\t\t\t\tmsg->payload.cfg.flags);\n+\t\t}\n+\n+\t\treturn rc == 0 ? RTE_VHOST_MSG_RESULT_OK : RTE_VHOST_MSG_RESULT_ERR;\n+\t}\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\n+\treturn RTE_VHOST_MSG_RESULT_NOT_HANDLED;\n+}\n+\n+struct rte_vhost_user_extern_ops g_blk_extern_vhost_ops = {\n+\t.pre_msg_handle = rte_vhost_blk_extern_vhost_pre_msg_handler,\n+\t.post_msg_handle = NULL,\n+};\n+\n+int\n+rte_vhost_blk_session_install_rte_compat_hooks(int vid)\n+{\n+\tint rc;\n+\n+\trc = rte_vhost_extern_callback_register(vid,\n+\t\t\t\t\t\t&g_blk_extern_vhost_ops,\n+\t\t\t\t\t\tNULL);\n+\tif (rc != 0) {\n+\t\tfprintf(stderr, \"%s() failed for vid = %d\\n\",  __func__, vid);\n+\t\treturn -1;\n+\t}\n+\tfprintf(stdout, \"register extern vhost ops on vid = %d\\n\", vid);\n+\treturn 0;\n+}\n+\n+\n+int\n+vdpa_blk_device_set_features_and_protocol(const char *path,\n+\tstruct rte_vdpa_device *vdev)\n+{\n+\tuint64_t protocol_features = 0;\n+\n+\tif (!vdev) {\n+\t\tfprintf(stdout, \"vdev is NULL.\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* vdpa net does not have the get_config */\n+\tif (!vdev->ops->get_config)\n+\t\treturn 0;\n+\n+\trte_vhost_driver_set_features(path, SPDK_VHOST_BLK_FEATURES_BASE);\n+\trte_vhost_driver_disable_features(path,\n+\t\tSPDK_VHOST_BLK_DISABLED_FEATURES);\n+\n+\trte_vhost_driver_get_protocol_features(path, &protocol_features);\n+\tprotocol_features |= (1ULL << VHOST_USER_PROTOCOL_F_CONFIG);\n+\tprotocol_features |= (1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD);\n+\trte_vhost_driver_set_protocol_features(path, protocol_features);\n+\n+\treturn 0;\n+}\ndiff --git a/examples/vdpa/vdpa_blk_compact.h b/examples/vdpa/vdpa_blk_compact.h\nnew file mode 100644\nindex 0000000..420d48e\n--- /dev/null\n+++ b/examples/vdpa/vdpa_blk_compact.h\n@@ -0,0 +1,117 @@\n+/*    INTEL CONFIDENTIAL\n+ *\n+ *    Copyright (c) Intel Corporation.\n+ *    All rights reserved.\n+ *\n+ *    The source code contained or described herein and all documents related\n+ *    to the source code (\"Material\") are owned by Intel Corporation or its\n+ *    suppliers or licensors.  Title to the Material remains with Intel\n+ *    Corporation or its suppliers and licensors.  The Material contains trade\n+ *    secrets and proprietary and confidential information of Intel or its\n+ *    suppliers and licensors.  The Material is protected by worldwide\n+ *    copyright and trade secret laws and treaty provisions.  No part of the\n+ *    Material may be used, copied, reproduced, modified, published, uploaded,\n+ *    posted, transmitted, distributed, or disclosed in any way without Intel's\n+ *    prior express written permission.\n+ *\n+ *    No license under any patent, copyright, trade secret or other\n+ *    intellectual property right is granted to or conferred upon you by\n+ *    disclosure or delivery of the Materials, either expressly, by\n+ *    implication, inducement, estoppel or otherwise.  Any license under such\n+ *    intellectual property rights must be express and approved by Intel in\n+ *    writing.\n+ */\n+\n+#ifndef _VDPA_BLK_COMPACT_H_\n+#define _VDPA_BLK_COMPACT_H_\n+\n+/**\n+ * @file\n+ *\n+ * Device specific vhost lib\n+ */\n+\n+#include <stdbool.h>\n+\n+#include <rte_pci.h>\n+#include <rte_vhost.h>\n+\n+/* Feature bits */\n+#define VIRTIO_BLK_F_SIZE_MAX     1    /* Indicates maximum segment size */\n+#define VIRTIO_BLK_F_SEG_MAX      2    /* Indicates maximum # of segments */\n+#define VIRTIO_BLK_F_GEOMETRY     4    /* Legacy geometry available  */\n+#define VIRTIO_BLK_F_RO           5    /* Disk is read-only */\n+#define VIRTIO_BLK_F_BLK_SIZE     6    /* Block size of disk is available */\n+#define VIRTIO_BLK_F_TOPOLOGY     10   /* Topology information is available */\n+#define VIRTIO_BLK_F_MQ           12   /* support more than one vq */\n+#define VIRTIO_BLK_F_DISCARD      13   /* DISCARD is supported */\n+#define VIRTIO_BLK_F_WRITE_ZEROES 14   /* WRITE ZEROES is supported */\n+\n+/* Legacy feature bits */\n+#ifndef VIRTIO_BLK_NO_LEGACY\n+#define VIRTIO_BLK_F_BARRIER      0    /* Does host support barriers? */\n+#define VIRTIO_BLK_F_SCSI         7    /* Supports scsi command passthru */\n+#define VIRTIO_BLK_F_FLUSH        9    /* Flush command supported */\n+#define VIRTIO_BLK_F_CONFIG_WCE   11   /* Writeback mode available in config */\n+\n+/* Old (deprecated) name for VIRTIO_BLK_F_FLUSH. */\n+#define VIRTIO_BLK_F_WCE VIRTIO_BLK_F_FLUSH\n+#endif /* !VIRTIO_BLK_NO_LEGACY */\n+\n+#ifndef VHOST_USER_F_PROTOCOL_FEATURES\n+#define VHOST_USER_F_PROTOCOL_FEATURES 30\n+#endif\n+\n+#define SPDK_VHOST_FEATURES ((1ULL << VHOST_F_LOG_ALL) | \\\n+\t(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \\\n+\t(1ULL << VIRTIO_F_VERSION_1) | \\\n+\t(1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \\\n+\t(1ULL << VIRTIO_RING_F_EVENT_IDX) | \\\n+\t(1ULL << VIRTIO_RING_F_INDIRECT_DESC))\n+\n+#define SPDK_VHOST_DISABLED_FEATURES ((1ULL << VIRTIO_RING_F_EVENT_IDX) | \\\n+\t(1ULL << VIRTIO_F_NOTIFY_ON_EMPTY))\n+\n+#define SPDK_VHOST_BLK_FEATURES_BASE (SPDK_VHOST_FEATURES | \\\n+\t(1ULL << VIRTIO_BLK_F_SIZE_MAX) | (1ULL << VIRTIO_BLK_F_SEG_MAX) | \\\n+\t(1ULL << VIRTIO_BLK_F_GEOMETRY) | (1ULL << VIRTIO_BLK_F_BLK_SIZE) | \\\n+\t(1ULL << VIRTIO_BLK_F_TOPOLOGY) | (1ULL << VIRTIO_BLK_F_BARRIER)  | \\\n+\t(1ULL << VIRTIO_BLK_F_SCSI)     | (1ULL << VIRTIO_BLK_F_CONFIG_WCE) | \\\n+\t(1ULL << VIRTIO_BLK_F_MQ))\n+\n+/* Not supported features */\n+#define SPDK_VHOST_BLK_DISABLED_FEATURES (SPDK_VHOST_DISABLED_FEATURES | \\\n+\t(1ULL << VIRTIO_BLK_F_GEOMETRY) | (1ULL << VIRTIO_BLK_F_CONFIG_WCE) | \\\n+\t(1ULL << VIRTIO_BLK_F_BARRIER)  | (1ULL << VIRTIO_BLK_F_SCSI))\n+\n+/* Vhost-blk support protocol features */\n+#define SPDK_VHOST_BLK_PROTOCOL_FEATURES \\\n+\t((1ULL << VHOST_USER_PROTOCOL_F_CONFIG) | \\\n+\t(1ULL << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD))\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * This function will set vhost user block\n+ *\n+ * @param path\n+ *  socket path\n+ */\n+int\n+vdpa_blk_device_set_features_and_protocol(const char *path,\n+\tstruct rte_vdpa_device *vdev);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Install external hook to handle vhost user block message\n+ *\n+ * @param vid\n+ *  vhost device id\n+ */\n+int\n+rte_vhost_blk_session_install_rte_compat_hooks(int vid);\n+\n+#endif /* _VDPA_BLK_COMPACT_H_ */\ndiff --git a/examples/vdpa/vhost_user.h b/examples/vdpa/vhost_user.h\nnew file mode 100644\nindex 0000000..8b747d0\n--- /dev/null\n+++ b/examples/vdpa/vhost_user.h\n@@ -0,0 +1,189 @@\n+/*    INTEL CONFIDENTIAL\n+ *\n+ *    Copyright (c) Intel Corporation.\n+ *    All rights reserved.\n+ *\n+ *    The source code contained or described herein and all documents related\n+ *    to the source code (\"Material\") are owned by Intel Corporation or its\n+ *    suppliers or licensors.  Title to the Material remains with Intel\n+ *    Corporation or its suppliers and licensors.  The Material contains trade\n+ *    secrets and proprietary and confidential information of Intel or its\n+ *    suppliers and licensors.  The Material is protected by worldwide\n+ *    copyright and trade secret laws and treaty provisions.  No part of the\n+ *    Material may be used, copied, reproduced, modified, published, uploaded,\n+ *    posted, transmitted, distributed, or disclosed in any way without Intel's\n+ *    prior express written permission.\n+ *\n+ *    No license under any patent, copyright, trade secret or other\n+ *    intellectual property right is granted to or conferred upon you by\n+ *    disclosure or delivery of the Materials, either expressly, by\n+ *    implication, inducement, estoppel or otherwise.  Any license under such\n+ *    intellectual property rights must be express and approved by Intel in\n+ *    writing.\n+ */\n+\n+#ifndef _VHOST_NET_USER_H\n+#define _VHOST_NET_USER_H\n+\n+#include <stdint.h>\n+#include <linux/vhost.h>\n+\n+#include \"rte_vhost.h\"\n+\n+/* refer to hw/virtio/vhost-user.c */\n+\n+#define VHOST_MEMORY_MAX_NREGIONS 8\n+\n+#ifndef VHOST_USER_MAX_CONFIG_SIZE\n+#define VHOST_USER_MAX_CONFIG_SIZE\t\t256\n+#endif\n+\n+#define VHOST_USER_PROTOCOL_FEATURES\t((1ULL << VHOST_USER_PROTOCOL_F_MQ) | \\\n+\t\t\t(1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) |\\\n+\t\t\t(1ULL << VHOST_USER_PROTOCOL_F_RARP) | \\\n+\t\t\t(1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK) | \\\n+\t\t\t(1ULL << VHOST_USER_PROTOCOL_F_NET_MTU) | \\\n+\t\t\t(1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ) | \\\n+\t\t\t(1ULL << VHOST_USER_PROTOCOL_F_CRYPTO_SESSION) | \\\n+\t\t\t(1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) | \\\n+\t\t\t(1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER) | \\\n+\t\t\t(1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT))\n+\n+typedef enum VhostUserRequest {\n+\tVHOST_USER_NONE = 0,\n+\tVHOST_USER_GET_FEATURES = 1,\n+\tVHOST_USER_SET_FEATURES = 2,\n+\tVHOST_USER_SET_OWNER = 3,\n+\tVHOST_USER_RESET_OWNER = 4,\n+\tVHOST_USER_SET_MEM_TABLE = 5,\n+\tVHOST_USER_SET_LOG_BASE = 6,\n+\tVHOST_USER_SET_LOG_FD = 7,\n+\tVHOST_USER_SET_VRING_NUM = 8,\n+\tVHOST_USER_SET_VRING_ADDR = 9,\n+\tVHOST_USER_SET_VRING_BASE = 10,\n+\tVHOST_USER_GET_VRING_BASE = 11,\n+\tVHOST_USER_SET_VRING_KICK = 12,\n+\tVHOST_USER_SET_VRING_CALL = 13,\n+\tVHOST_USER_SET_VRING_ERR = 14,\n+\tVHOST_USER_GET_PROTOCOL_FEATURES = 15,\n+\tVHOST_USER_SET_PROTOCOL_FEATURES = 16,\n+\tVHOST_USER_GET_QUEUE_NUM = 17,\n+\tVHOST_USER_SET_VRING_ENABLE = 18,\n+\tVHOST_USER_SEND_RARP = 19,\n+\tVHOST_USER_NET_SET_MTU = 20,\n+\tVHOST_USER_SET_SLAVE_REQ_FD = 21,\n+\tVHOST_USER_IOTLB_MSG = 22,\n+\tVHOST_USER_CRYPTO_CREATE_SESS = 26,\n+\tVHOST_USER_CRYPTO_CLOSE_SESS = 27,\n+\tVHOST_USER_POSTCOPY_ADVISE = 28,\n+\tVHOST_USER_POSTCOPY_LISTEN = 29,\n+\tVHOST_USER_POSTCOPY_END = 30,\n+\tVHOST_USER_GET_INFLIGHT_FD = 31,\n+\tVHOST_USER_SET_INFLIGHT_FD = 32,\n+\tVHOST_USER_MAX = 33\n+} VhostUserRequest;\n+\n+typedef enum VhostUserSlaveRequest {\n+\tVHOST_USER_SLAVE_NONE = 0,\n+\tVHOST_USER_SLAVE_IOTLB_MSG = 1,\n+\tVHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,\n+\tVHOST_USER_SLAVE_MAX\n+} VhostUserSlaveRequest;\n+\n+typedef struct VhostUserMemoryRegion {\n+\tuint64_t guest_phys_addr;\n+\tuint64_t memory_size;\n+\tuint64_t userspace_addr;\n+\tuint64_t mmap_offset;\n+} VhostUserMemoryRegion;\n+\n+typedef struct VhostUserMemory {\n+\tuint32_t nregions;\n+\tuint32_t padding;\n+\tVhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS];\n+} VhostUserMemory;\n+\n+typedef struct VhostUserLog {\n+\tuint64_t mmap_size;\n+\tuint64_t mmap_offset;\n+} VhostUserLog;\n+\n+/* Comply with Cryptodev-Linux */\n+#define VHOST_USER_CRYPTO_MAX_HMAC_KEY_LENGTH\t512\n+#define VHOST_USER_CRYPTO_MAX_CIPHER_KEY_LENGTH\t64\n+\n+/* Same structure as vhost-user backend session info */\n+typedef struct VhostUserCryptoSessionParam {\n+\tint64_t session_id;\n+\tuint32_t op_code;\n+\tuint32_t cipher_algo;\n+\tuint32_t cipher_key_len;\n+\tuint32_t hash_algo;\n+\tuint32_t digest_len;\n+\tuint32_t auth_key_len;\n+\tuint32_t aad_len;\n+\tuint8_t op_type;\n+\tuint8_t dir;\n+\tuint8_t hash_mode;\n+\tuint8_t chaining_dir;\n+\tuint8_t *ciphe_key;\n+\tuint8_t *auth_key;\n+\tuint8_t cipher_key_buf[VHOST_USER_CRYPTO_MAX_CIPHER_KEY_LENGTH];\n+\tuint8_t auth_key_buf[VHOST_USER_CRYPTO_MAX_HMAC_KEY_LENGTH];\n+} VhostUserCryptoSessionParam;\n+\n+typedef struct VhostUserVringArea {\n+\tuint64_t u64;\n+\tuint64_t size;\n+\tuint64_t offset;\n+} VhostUserVringArea;\n+\n+typedef struct VhostUserInflight {\n+\tuint64_t mmap_size;\n+\tuint64_t mmap_offset;\n+\tuint16_t num_queues;\n+\tuint16_t queue_size;\n+} VhostUserInflight;\n+\n+/** Get/set config msg payload */\n+struct vhost_user_config {\n+\tuint32_t offset;\n+\tuint32_t size;\n+\tuint32_t flags;\n+\tuint8_t region[VHOST_USER_MAX_CONFIG_SIZE];\n+};\n+\n+typedef struct VhostUserMsg {\n+\tunion {\n+\t\tuint32_t master; /* a VhostUserRequest value */\n+\t\tuint32_t slave;  /* a VhostUserSlaveRequest value*/\n+\t} request;\n+\n+#define VHOST_USER_VERSION_MASK     0x3\n+#define VHOST_USER_REPLY_MASK       (0x1 << 2)\n+#define VHOST_USER_NEED_REPLY\t\t(0x1 << 3)\n+\tuint32_t flags;\n+\tuint32_t size; /* the following payload size */\n+\tunion {\n+#define VHOST_USER_VRING_IDX_MASK   0xff\n+#define VHOST_USER_VRING_NOFD_MASK  (0x1<<8)\n+\t\tuint64_t u64;\n+\t\tstruct vhost_vring_state state;\n+\t\tstruct vhost_vring_addr addr;\n+\t\tVhostUserMemory memory;\n+\t\tVhostUserLog    log;\n+\t\tstruct vhost_iotlb_msg iotlb;\n+\t\tVhostUserCryptoSessionParam crypto_session;\n+\t\tVhostUserVringArea area;\n+\t\tVhostUserInflight inflight;\n+\t\tstruct vhost_user_config cfg;\n+\t} payload;\n+\tint fds[VHOST_MEMORY_MAX_NREGIONS];\n+\tint fd_num;\n+} __attribute((packed)) VhostUserMsg;\n+\n+#define VHOST_USER_HDR_SIZE offsetof(VhostUserMsg, payload.u64)\n+\n+/* The version of the protocol we support */\n+#define VHOST_USER_VERSION    0x1\n+#endif\n",
    "prefixes": [
        "v3",
        "06/15"
    ]
}