get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 106235,
    "url": "http://patchwork.dpdk.org/api/patches/106235/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20220123115927.76130-2-cfontain@redhat.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20220123115927.76130-2-cfontain@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220123115927.76130-2-cfontain@redhat.com",
    "date": "2022-01-23T11:59:27",
    "name": "[1/1] vhost: Move fds outside of VhostUserMessage",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f80883b41520afeffee28b5e97204ed78411525f",
    "submitter": {
        "id": 2496,
        "url": "http://patchwork.dpdk.org/api/people/2496/?format=api",
        "name": "Christophe Fontaine",
        "email": "cfontain@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patchwork.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20220123115927.76130-2-cfontain@redhat.com/mbox/",
    "series": [
        {
            "id": 21311,
            "url": "http://patchwork.dpdk.org/api/series/21311/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=21311",
            "date": "2022-01-23T11:59:26",
            "name": "Removes FDs from VhostUserMessage structure",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/21311/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/106235/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/106235/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 3E15DA04A2;\n\tSun, 23 Jan 2022 12:59:57 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 29F6C42795;\n\tSun, 23 Jan 2022 12:59:57 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id 43EAF41199\n for <dev@dpdk.org>; Sun, 23 Jan 2022 12:59:55 +0100 (CET)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-145-VE62NCDWNsKUPWuY6TH01w-1; Sun, 23 Jan 2022 06:59:51 -0500",
            "from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com\n [10.5.11.23])\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 7862418B9ECA;\n Sun, 23 Jan 2022 11:59:50 +0000 (UTC)",
            "from localhost.localdomain (unknown [10.39.208.4])\n by smtp.corp.redhat.com (Postfix) with ESMTP id A690B22E07;\n Sun, 23 Jan 2022 11:59:48 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1642939194;\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=CvPKk267L6XoZpx6pkZCjLiFpBQkjPMpdWcvX/8cplY=;\n b=UPtij6pD8/2D/0vIpt10tPFcoTshBDS9Wh/rlm+YnKlu/a3vlrZtLLzhVK5YbMhKAtsBIi\n LQ79PWEUrTUivciBIZEUb03iZQ27a3tGpUewjgyehRjk19PlSrbHwcnaEzadpV8UxmY1sU\n 7jrzkraUd4sAWSP+mfAKUWs7rSn3fxY=",
        "X-MC-Unique": "VE62NCDWNsKUPWuY6TH01w-1",
        "From": "Christophe Fontaine <cfontain@redhat.com>",
        "To": "maxime.coquelin@redhat.com,\n\tchenbo.xia@intel.com",
        "Cc": "dev@dpdk.org,\n\tChristophe Fontaine <cfontain@redhat.com>",
        "Subject": "[PATCH 1/1] vhost: Move fds outside of VhostUserMessage",
        "Date": "Sun, 23 Jan 2022 12:59:27 +0100",
        "Message-Id": "<20220123115927.76130-2-cfontain@redhat.com>",
        "In-Reply-To": "<20220123115927.76130-1-cfontain@redhat.com>",
        "References": "<20220123115927.76130-1-cfontain@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.84 on 10.5.11.23",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cfontain@redhat.com",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"",
        "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": "FDs at the end of the VhostUserMessage structure limits the size\nof the payload. Move them to an other englobing structure, before\nthe header & payload of a VhostUserMessage.\nAlso removes a reference to fds in the VHUMsg structure defined in\ndrivers/net/virtio/virtio_user/vhost_user.c\n\nSigned-off-by: Christophe Fontaine <cfontain@redhat.com>\n---\n drivers/net/virtio/virtio_user/vhost_user.c |   1 -\n lib/vhost/vhost_crypto.c                    |  10 +-\n lib/vhost/vhost_user.c                      | 529 ++++++++++----------\n lib/vhost/vhost_user.h                      |   7 +-\n 4 files changed, 288 insertions(+), 259 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c\nindex cc830a660f..c9e445f6c8 100644\n--- a/drivers/net/virtio/virtio_user/vhost_user.c\n+++ b/drivers/net/virtio/virtio_user/vhost_user.c\n@@ -97,7 +97,6 @@ struct vhost_user_msg {\n \t\tstruct vhost_vring_addr addr;\n \t\tstruct vhost_memory memory;\n \t} payload;\n-\tint fds[VHOST_MEMORY_MAX_NREGIONS];\n } __rte_packed;\n \n #define VHOST_USER_HDR_SIZE offsetof(struct vhost_user_msg, payload.u64)\ndiff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c\nindex 926b5c0bd9..afaf19ec80 100644\n--- a/lib/vhost/vhost_crypto.c\n+++ b/lib/vhost/vhost_crypto.c\n@@ -453,7 +453,7 @@ 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+\tstruct vhu_msg_context *ctx = msg;\n \tenum rte_vhost_msg_result ret = RTE_VHOST_MSG_RESULT_OK;\n \n \tif (dev == NULL) {\n@@ -467,15 +467,15 @@ vhost_crypto_msg_post_handler(int vid, void *msg)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \n-\tswitch (vmsg->request.master) {\n+\tswitch (ctx->msg.request.master) {\n \tcase VHOST_USER_CRYPTO_CREATE_SESS:\n \t\tvhost_crypto_create_sess(vcrypto,\n-\t\t\t\t&vmsg->payload.crypto_session);\n-\t\tvmsg->fd_num = 0;\n+\t\t\t\t&ctx->msg.payload.crypto_session);\n+\t\tctx->fd_num = 0;\n \t\tret = RTE_VHOST_MSG_RESULT_REPLY;\n \t\tbreak;\n \tcase VHOST_USER_CRYPTO_CLOSE_SESS:\n-\t\tif (vhost_crypto_close_sess(vcrypto, vmsg->payload.u64))\n+\t\tif (vhost_crypto_close_sess(vcrypto, ctx->msg.payload.u64))\n \t\t\tret = RTE_VHOST_MSG_RESULT_ERR;\n \t\tbreak;\n \tdefault:\ndiff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c\nindex 5eb1dd6812..7bc2aa2132 100644\n--- a/lib/vhost/vhost_user.c\n+++ b/lib/vhost/vhost_user.c\n@@ -93,21 +93,21 @@ static const char *vhost_message_str[VHOST_USER_MAX] = {\n \t[VHOST_USER_GET_STATUS] = \"VHOST_USER_GET_STATUS\",\n };\n \n-static int send_vhost_reply(int sockfd, struct VhostUserMsg *msg);\n-static int read_vhost_message(int sockfd, struct VhostUserMsg *msg);\n+static int send_vhost_reply(int sockfd, struct vhu_msg_context *msg);\n+static int read_vhost_message(int sockfd, struct vhu_msg_context *msg);\n \n static void\n-close_msg_fds(struct VhostUserMsg *msg)\n+close_msg_fds(struct vhu_msg_context *ctx)\n {\n \tint i;\n \n-\tfor (i = 0; i < msg->fd_num; i++) {\n-\t\tint fd = msg->fds[i];\n+\tfor (i = 0; i < ctx->fd_num; i++) {\n+\t\tint fd = ctx->fds[i];\n \n \t\tif (fd == -1)\n \t\t\tcontinue;\n \n-\t\tmsg->fds[i] = -1;\n+\t\tctx->fds[i] = -1;\n \t\tclose(fd);\n \t}\n }\n@@ -117,18 +117,18 @@ close_msg_fds(struct VhostUserMsg *msg)\n  * close all FDs and return an error if this is not the case.\n  */\n static int\n-validate_msg_fds(struct VhostUserMsg *msg, int expected_fds)\n+validate_msg_fds(struct vhu_msg_context *ctx, int expected_fds)\n {\n-\tif (msg->fd_num == expected_fds)\n+\tif (ctx->fd_num == expected_fds)\n \t\treturn 0;\n \n \tVHOST_LOG_CONFIG(ERR,\n \t\t\" Expect %d FDs for request %s, received %d\\n\",\n \t\texpected_fds,\n-\t\tvhost_message_str[msg->request.master],\n-\t\tmsg->fd_num);\n+\t\tvhost_message_str[ctx->msg.request.master],\n+\t\tctx->fd_num);\n \n-\tclose_msg_fds(msg);\n+\tclose_msg_fds(ctx);\n \n \treturn -1;\n }\n@@ -288,10 +288,10 @@ vhost_user_notify_queue_state(struct virtio_net *dev, uint16_t index,\n  */\n static int\n vhost_user_set_owner(struct virtio_net **pdev __rte_unused,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \treturn RTE_VHOST_MSG_RESULT_OK;\n@@ -299,12 +299,12 @@ vhost_user_set_owner(struct virtio_net **pdev __rte_unused,\n \n static int\n vhost_user_reset_owner(struct virtio_net **pdev,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tvhost_destroy_device_notify(dev);\n@@ -318,20 +318,21 @@ vhost_user_reset_owner(struct virtio_net **pdev,\n  * The features that we support are requested.\n  */\n static int\n-vhost_user_get_features(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_get_features(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n \tuint64_t features = 0;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \trte_vhost_driver_get_features(dev->ifname, &features);\n \n-\tmsg->payload.u64 = features;\n-\tmsg->size = sizeof(msg->payload.u64);\n-\tmsg->fd_num = 0;\n+\tctx->msg.payload.u64 = features;\n+\tctx->msg.size = sizeof(ctx->msg.payload.u64);\n+\tctx->fd_num = 0;\n \n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n }\n@@ -340,20 +341,21 @@ vhost_user_get_features(struct virtio_net **pdev, struct VhostUserMsg *msg,\n  * The queue number that we support are requested.\n  */\n static int\n-vhost_user_get_queue_num(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_get_queue_num(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n \tuint32_t queue_num = 0;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \trte_vhost_driver_get_queue_num(dev->ifname, &queue_num);\n \n-\tmsg->payload.u64 = (uint64_t)queue_num;\n-\tmsg->size = sizeof(msg->payload.u64);\n-\tmsg->fd_num = 0;\n+\tctx->msg.payload.u64 = (uint64_t)queue_num;\n+\tctx->msg.size = sizeof(ctx->msg.payload.u64);\n+\tctx->fd_num = 0;\n \n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n }\n@@ -362,15 +364,16 @@ vhost_user_get_queue_num(struct virtio_net **pdev, struct VhostUserMsg *msg,\n  * We receive the negotiated features supported by us and the virtio device.\n  */\n static int\n-vhost_user_set_features(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_set_features(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tuint64_t features = msg->payload.u64;\n+\tuint64_t features = ctx->msg.payload.u64;\n \tuint64_t vhost_features = 0;\n \tstruct rte_vdpa_device *vdpa_dev;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \trte_vhost_driver_get_features(dev->ifname, &vhost_features);\n@@ -455,21 +458,22 @@ vhost_user_set_features(struct virtio_net **pdev, struct VhostUserMsg *msg,\n  */\n static int\n vhost_user_set_vring_num(struct virtio_net **pdev,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tstruct vhost_virtqueue *vq = dev->virtqueue[msg->payload.state.index];\n+\tstruct vhost_virtqueue *vq = dev->virtqueue[ctx->msg.payload.state.index];\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n-\tif (msg->payload.state.num > 32768) {\n-\t\tVHOST_LOG_CONFIG(ERR, \"invalid virtqueue size %u\\n\", msg->payload.state.num);\n+\tif (ctx->msg.payload.state.num > 32768) {\n+\t\tVHOST_LOG_CONFIG(ERR, \"invalid virtqueue size %u\\n\",\n+\t\t\t\tctx->msg.payload.state.num);\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \n-\tvq->size = msg->payload.state.num;\n+\tvq->size = ctx->msg.payload.state.num;\n \n \t/* VIRTIO 1.0, 2.4 Virtqueues says:\n \t *\n@@ -899,22 +903,23 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index)\n  * This function then converts these to our address space.\n  */\n static int\n-vhost_user_set_vring_addr(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_set_vring_addr(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n \tstruct vhost_virtqueue *vq;\n-\tstruct vhost_vring_addr *addr = &msg->payload.addr;\n+\tstruct vhost_vring_addr *addr = &ctx->msg.payload.addr;\n \tbool access_ok;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tif (dev->mem == NULL)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \t/* addr->index refers to the queue index. The txq 1, rxq is 0. */\n-\tvq = dev->virtqueue[msg->payload.addr.index];\n+\tvq = dev->virtqueue[ctx->msg.payload.addr.index];\n \n \taccess_ok = vq->access_ok;\n \n@@ -929,7 +934,7 @@ vhost_user_set_vring_addr(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \tif ((vq->enabled && (dev->features &\n \t\t\t\t(1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) ||\n \t\t\taccess_ok) {\n-\t\tdev = translate_ring_addresses(dev, msg->payload.addr.index);\n+\t\tdev = translate_ring_addresses(dev, ctx->msg.payload.addr.index);\n \t\tif (!dev)\n \t\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n@@ -944,14 +949,14 @@ vhost_user_set_vring_addr(struct virtio_net **pdev, struct VhostUserMsg *msg,\n  */\n static int\n vhost_user_set_vring_base(struct virtio_net **pdev,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tstruct vhost_virtqueue *vq = dev->virtqueue[msg->payload.state.index];\n-\tuint64_t val = msg->payload.state.num;\n+\tstruct vhost_virtqueue *vq = dev->virtqueue[ctx->msg.payload.state.index];\n+\tuint64_t val = ctx->msg.payload.state.num;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tif (vq_is_packed(dev)) {\n@@ -969,8 +974,8 @@ vhost_user_set_vring_base(struct virtio_net **pdev,\n \t\tvq->last_used_idx = vq->last_avail_idx;\n \t\tvq->used_wrap_counter = vq->avail_wrap_counter;\n \t} else {\n-\t\tvq->last_used_idx = msg->payload.state.num;\n-\t\tvq->last_avail_idx = msg->payload.state.num;\n+\t\tvq->last_used_idx = ctx->msg.payload.state.num;\n+\t\tvq->last_avail_idx = ctx->msg.payload.state.num;\n \t}\n \n \treturn RTE_VHOST_MSG_RESULT_OK;\n@@ -1152,11 +1157,11 @@ vhost_user_postcopy_region_register(struct virtio_net *dev __rte_unused,\n \n static int\n vhost_user_postcopy_register(struct virtio_net *dev, int main_fd,\n-\t\tstruct VhostUserMsg *msg)\n+\t\tstruct vhu_msg_context *ctx)\n {\n \tstruct VhostUserMemory *memory;\n \tstruct rte_vhost_mem_region *reg;\n-\tVhostUserMsg ack_msg;\n+\tstruct vhu_msg_context ack_msg;\n \tuint32_t i;\n \n \tif (!dev->postcopy_listening)\n@@ -1167,15 +1172,15 @@ vhost_user_postcopy_register(struct virtio_net *dev, int main_fd,\n \t * DPDK's virtual address with Qemu, so that Qemu can\n \t * retrieve the region offset when handling userfaults.\n \t */\n-\tmemory = &msg->payload.memory;\n+\tmemory = &ctx->msg.payload.memory;\n \tfor (i = 0; i < memory->nregions; i++) {\n \t\treg = &dev->mem->regions[i];\n \t\tmemory->regions[i].userspace_addr = reg->host_user_addr;\n \t}\n \n \t/* Send the addresses back to qemu */\n-\tmsg->fd_num = 0;\n-\tsend_vhost_reply(main_fd, msg);\n+\tctx->fd_num = 0;\n+\tsend_vhost_reply(main_fd, ctx);\n \n \t/* Wait for qemu to acknowledge it got the addresses\n \t * we've got to wait before we're allowed to generate faults.\n@@ -1189,10 +1194,10 @@ vhost_user_postcopy_register(struct virtio_net *dev, int main_fd,\n \tif (validate_msg_fds(&ack_msg, 0) != 0)\n \t\treturn -1;\n \n-\tif (ack_msg.request.master != VHOST_USER_SET_MEM_TABLE) {\n+\tif (ack_msg.msg.request.master != VHOST_USER_SET_MEM_TABLE) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\t\"Bad qemu ack on postcopy set-mem-table (%d)\\n\",\n-\t\t\t\tack_msg.request.master);\n+\t\t\t\tack_msg.msg.request.master);\n \t\treturn -1;\n \t}\n \n@@ -1306,18 +1311,19 @@ vhost_user_mmap_region(struct virtio_net *dev,\n }\n \n static int\n-vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_set_mem_table(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tstruct VhostUserMemory *memory = &msg->payload.memory;\n+\tstruct VhostUserMemory *memory = &ctx->msg.payload.memory;\n \tstruct rte_vhost_mem_region *reg;\n \tint numa_node = SOCKET_ID_ANY;\n \tuint64_t mmap_offset;\n \tuint32_t i;\n \tbool async_notify = false;\n \n-\tif (validate_msg_fds(msg, memory->nregions) != 0)\n+\tif (validate_msg_fds(ctx, memory->nregions) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tif (memory->nregions > VHOST_MEMORY_MAX_NREGIONS) {\n@@ -1330,7 +1336,7 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t\tVHOST_LOG_CONFIG(INFO,\n \t\t\t\"(%d) memory regions not changed\\n\", dev->vid);\n \n-\t\tclose_msg_fds(msg);\n+\t\tclose_msg_fds(ctx);\n \n \t\treturn RTE_VHOST_MSG_RESULT_OK;\n \t}\n@@ -1402,13 +1408,13 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t\treg->guest_phys_addr = memory->regions[i].guest_phys_addr;\n \t\treg->guest_user_addr = memory->regions[i].userspace_addr;\n \t\treg->size            = memory->regions[i].memory_size;\n-\t\treg->fd              = msg->fds[i];\n+\t\treg->fd              = ctx->fds[i];\n \n \t\t/*\n \t\t * Assign invalid file descriptor value to avoid double\n \t\t * closing on error path.\n \t\t */\n-\t\tmsg->fds[i] = -1;\n+\t\tctx->fds[i] = -1;\n \n \t\tmmap_offset = memory->regions[i].mmap_offset;\n \n@@ -1420,7 +1426,7 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t\tdev->mem->nregions++;\n \t}\n \n-\tif (vhost_user_postcopy_register(dev, main_fd, msg) < 0)\n+\tif (vhost_user_postcopy_register(dev, main_fd, ctx) < 0)\n \t\tgoto free_mem_table;\n \n \tfor (i = 0; i < dev->nr_vring; i++) {\n@@ -1465,7 +1471,7 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \trte_free(dev->guest_pages);\n \tdev->guest_pages = NULL;\n close_msg_fds:\n-\tclose_msg_fds(msg);\n+\tclose_msg_fds(ctx);\n \treturn RTE_VHOST_MSG_RESULT_ERR;\n }\n \n@@ -1592,7 +1598,7 @@ get_pervq_shm_size_packed(uint16_t queue_size)\n \n static int\n vhost_user_get_inflight_fd(struct virtio_net **pdev,\n-\t\t\t   VhostUserMsg *msg,\n+\t\t\t   struct vhu_msg_context *ctx,\n \t\t\t   int main_fd __rte_unused)\n {\n \tstruct rte_vhost_inflight_info_packed *inflight_packed;\n@@ -1603,10 +1609,10 @@ vhost_user_get_inflight_fd(struct virtio_net **pdev,\n \tint numa_node = SOCKET_ID_ANY;\n \tvoid *addr;\n \n-\tif (msg->size != sizeof(msg->payload.inflight)) {\n+\tif (ctx->msg.size != sizeof(ctx->msg.payload.inflight)) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"invalid get_inflight_fd message size is %d\\n\",\n-\t\t\tmsg->size);\n+\t\t\tctx->msg.size);\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \n@@ -1628,13 +1634,13 @@ vhost_user_get_inflight_fd(struct virtio_net **pdev,\n \t\tdev->inflight_info->fd = -1;\n \t}\n \n-\tnum_queues = msg->payload.inflight.num_queues;\n-\tqueue_size = msg->payload.inflight.queue_size;\n+\tnum_queues = ctx->msg.payload.inflight.num_queues;\n+\tqueue_size = ctx->msg.payload.inflight.queue_size;\n \n \tVHOST_LOG_CONFIG(INFO, \"get_inflight_fd num_queues: %u\\n\",\n-\t\tmsg->payload.inflight.num_queues);\n+\t\tctx->msg.payload.inflight.num_queues);\n \tVHOST_LOG_CONFIG(INFO, \"get_inflight_fd queue_size: %u\\n\",\n-\t\tmsg->payload.inflight.queue_size);\n+\t\tctx->msg.payload.inflight.queue_size);\n \n \tif (vq_is_packed(dev))\n \t\tpervq_inflight_size = get_pervq_shm_size_packed(queue_size);\n@@ -1646,7 +1652,7 @@ vhost_user_get_inflight_fd(struct virtio_net **pdev,\n \tif (!addr) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"failed to alloc vhost inflight area\\n\");\n-\t\t\tmsg->payload.inflight.mmap_size = 0;\n+\t\t\tctx->msg.payload.inflight.mmap_size = 0;\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \tmemset(addr, 0, mmap_size);\n@@ -1662,10 +1668,10 @@ vhost_user_get_inflight_fd(struct virtio_net **pdev,\n \t}\n \n \tdev->inflight_info->addr = addr;\n-\tdev->inflight_info->size = msg->payload.inflight.mmap_size = mmap_size;\n-\tdev->inflight_info->fd = msg->fds[0] = fd;\n-\tmsg->payload.inflight.mmap_offset = 0;\n-\tmsg->fd_num = 1;\n+\tdev->inflight_info->size = ctx->msg.payload.inflight.mmap_size = mmap_size;\n+\tdev->inflight_info->fd = ctx->fds[0] = fd;\n+\tctx->msg.payload.inflight.mmap_offset = 0;\n+\tctx->fd_num = 1;\n \n \tif (vq_is_packed(dev)) {\n \t\tfor (i = 0; i < num_queues; i++) {\n@@ -1681,18 +1687,19 @@ vhost_user_get_inflight_fd(struct virtio_net **pdev,\n \n \tVHOST_LOG_CONFIG(INFO,\n \t\t\"send inflight mmap_size: %\"PRIu64\"\\n\",\n-\t\tmsg->payload.inflight.mmap_size);\n+\t\tctx->msg.payload.inflight.mmap_size);\n \tVHOST_LOG_CONFIG(INFO,\n \t\t\"send inflight mmap_offset: %\"PRIu64\"\\n\",\n-\t\tmsg->payload.inflight.mmap_offset);\n+\t\tctx->msg.payload.inflight.mmap_offset);\n \tVHOST_LOG_CONFIG(INFO,\n-\t\t\"send inflight fd: %d\\n\", msg->fds[0]);\n+\t\t\"send inflight fd: %d\\n\", ctx->fds[0]);\n \n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n }\n \n static int\n-vhost_user_set_inflight_fd(struct virtio_net **pdev, VhostUserMsg *msg,\n+vhost_user_set_inflight_fd(struct virtio_net **pdev,\n+\t\t\t   struct vhu_msg_context *ctx,\n \t\t\t   int main_fd __rte_unused)\n {\n \tuint64_t mmap_size, mmap_offset;\n@@ -1704,18 +1711,18 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev, VhostUserMsg *msg,\n \tint fd, i;\n \tint numa_node = SOCKET_ID_ANY;\n \n-\tfd = msg->fds[0];\n-\tif (msg->size != sizeof(msg->payload.inflight) || fd < 0) {\n+\tfd = ctx->fds[0];\n+\tif (ctx->msg.size != sizeof(ctx->msg.payload.inflight) || fd < 0) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"invalid set_inflight_fd message size is %d,fd is %d\\n\",\n-\t\t\tmsg->size, fd);\n+\t\t\tctx->msg.size, fd);\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \n-\tmmap_size = msg->payload.inflight.mmap_size;\n-\tmmap_offset = msg->payload.inflight.mmap_offset;\n-\tnum_queues = msg->payload.inflight.num_queues;\n-\tqueue_size = msg->payload.inflight.queue_size;\n+\tmmap_size = ctx->msg.payload.inflight.mmap_size;\n+\tmmap_offset = ctx->msg.payload.inflight.mmap_offset;\n+\tnum_queues = ctx->msg.payload.inflight.num_queues;\n+\tqueue_size = ctx->msg.payload.inflight.queue_size;\n \n \tif (vq_is_packed(dev))\n \t\tpervq_inflight_size = get_pervq_shm_size_packed(queue_size);\n@@ -1794,7 +1801,8 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev, VhostUserMsg *msg,\n }\n \n static int\n-vhost_user_set_vring_call(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_set_vring_call(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n@@ -1802,15 +1810,15 @@ vhost_user_set_vring_call(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \tstruct vhost_virtqueue *vq;\n \tint expected_fds;\n \n-\texpected_fds = (msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK) ? 0 : 1;\n-\tif (validate_msg_fds(msg, expected_fds) != 0)\n+\texpected_fds = (ctx->msg.payload.u64 & VHOST_USER_VRING_NOFD_MASK) ? 0 : 1;\n+\tif (validate_msg_fds(ctx, expected_fds) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n-\tfile.index = msg->payload.u64 & VHOST_USER_VRING_IDX_MASK;\n-\tif (msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)\n+\tfile.index = ctx->msg.payload.u64 & VHOST_USER_VRING_IDX_MASK;\n+\tif (ctx->msg.payload.u64 & VHOST_USER_VRING_NOFD_MASK)\n \t\tfile.fd = VIRTIO_INVALID_EVENTFD;\n \telse\n-\t\tfile.fd = msg->fds[0];\n+\t\tfile.fd = ctx->fds[0];\n \tVHOST_LOG_CONFIG(INFO,\n \t\t\"vring call idx:%d file:%d\\n\", file.index, file.fd);\n \n@@ -1830,17 +1838,17 @@ vhost_user_set_vring_call(struct virtio_net **pdev, struct VhostUserMsg *msg,\n }\n \n static int vhost_user_set_vring_err(struct virtio_net **pdev __rte_unused,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tint expected_fds;\n \n-\texpected_fds = (msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK) ? 0 : 1;\n-\tif (validate_msg_fds(msg, expected_fds) != 0)\n+\texpected_fds = (ctx->msg.payload.u64 & VHOST_USER_VRING_NOFD_MASK) ? 0 : 1;\n+\tif (validate_msg_fds(ctx, expected_fds) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n-\tif (!(msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK))\n-\t\tclose(msg->fds[0]);\n+\tif (!(ctx->msg.payload.u64 & VHOST_USER_VRING_NOFD_MASK))\n+\t\tclose(ctx->fds[0]);\n \tVHOST_LOG_CONFIG(INFO, \"not implemented\\n\");\n \n \treturn RTE_VHOST_MSG_RESULT_OK;\n@@ -2042,7 +2050,8 @@ vhost_check_queue_inflights_packed(struct virtio_net *dev,\n }\n \n static int\n-vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_set_vring_kick(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n@@ -2050,15 +2059,15 @@ vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \tstruct vhost_virtqueue *vq;\n \tint expected_fds;\n \n-\texpected_fds = (msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK) ? 0 : 1;\n-\tif (validate_msg_fds(msg, expected_fds) != 0)\n+\texpected_fds = (ctx->msg.payload.u64 & VHOST_USER_VRING_NOFD_MASK) ? 0 : 1;\n+\tif (validate_msg_fds(ctx, expected_fds) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n-\tfile.index = msg->payload.u64 & VHOST_USER_VRING_IDX_MASK;\n-\tif (msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)\n+\tfile.index = ctx->msg.payload.u64 & VHOST_USER_VRING_IDX_MASK;\n+\tif (ctx->msg.payload.u64 & VHOST_USER_VRING_NOFD_MASK)\n \t\tfile.fd = VIRTIO_INVALID_EVENTFD;\n \telse\n-\t\tfile.fd = msg->fds[0];\n+\t\tfile.fd = ctx->fds[0];\n \tVHOST_LOG_CONFIG(INFO,\n \t\t\"vring kick idx:%d file:%d\\n\", file.index, file.fd);\n \n@@ -2115,14 +2124,14 @@ vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg,\n  */\n static int\n vhost_user_get_vring_base(struct virtio_net **pdev,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tstruct vhost_virtqueue *vq = dev->virtqueue[msg->payload.state.index];\n+\tstruct vhost_virtqueue *vq = dev->virtqueue[ctx->msg.payload.state.index];\n \tuint64_t val;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \t/* We have to stop the queue (virtio) if it is running. */\n@@ -2139,14 +2148,14 @@ vhost_user_get_vring_base(struct virtio_net **pdev,\n \t\t */\n \t\tval = vq->last_avail_idx & 0x7fff;\n \t\tval |= vq->avail_wrap_counter << 15;\n-\t\tmsg->payload.state.num = val;\n+\t\tctx->msg.payload.state.num = val;\n \t} else {\n-\t\tmsg->payload.state.num = vq->last_avail_idx;\n+\t\tctx->msg.payload.state.num = vq->last_avail_idx;\n \t}\n \n \tVHOST_LOG_CONFIG(INFO,\n-\t\t\"vring base idx:%d file:%d\\n\", msg->payload.state.index,\n-\t\tmsg->payload.state.num);\n+\t\t\"vring base idx:%d file:%d\\n\", ctx->msg.payload.state.index,\n+\t\tctx->msg.payload.state.num);\n \t/*\n \t * Based on current qemu vhost-user implementation, this message is\n \t * sent and only sent in vhost_vring_stop.\n@@ -2178,8 +2187,8 @@ vhost_user_get_vring_base(struct virtio_net **pdev,\n \trte_free(vq->log_cache);\n \tvq->log_cache = NULL;\n \n-\tmsg->size = sizeof(msg->payload.state);\n-\tmsg->fd_num = 0;\n+\tctx->msg.size = sizeof(ctx->msg.payload.state);\n+\tctx->fd_num = 0;\n \n \tvhost_user_iotlb_flush_all(vq);\n \n@@ -2194,14 +2203,14 @@ vhost_user_get_vring_base(struct virtio_net **pdev,\n  */\n static int\n vhost_user_set_vring_enable(struct virtio_net **pdev,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tbool enable = !!msg->payload.state.num;\n-\tint index = (int)msg->payload.state.index;\n+\tbool enable = !!ctx->msg.payload.state.num;\n+\tint index = (int)ctx->msg.payload.state.index;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tVHOST_LOG_CONFIG(INFO,\n@@ -2223,35 +2232,35 @@ vhost_user_set_vring_enable(struct virtio_net **pdev,\n \n static int\n vhost_user_get_protocol_features(struct virtio_net **pdev,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n \tuint64_t features, protocol_features;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \trte_vhost_driver_get_features(dev->ifname, &features);\n \trte_vhost_driver_get_protocol_features(dev->ifname, &protocol_features);\n \n-\tmsg->payload.u64 = protocol_features;\n-\tmsg->size = sizeof(msg->payload.u64);\n-\tmsg->fd_num = 0;\n+\tctx->msg.payload.u64 = protocol_features;\n+\tctx->msg.size = sizeof(ctx->msg.payload.u64);\n+\tctx->fd_num = 0;\n \n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n }\n \n static int\n vhost_user_set_protocol_features(struct virtio_net **pdev,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tuint64_t protocol_features = msg->payload.u64;\n+\tuint64_t protocol_features = ctx->msg.payload.u64;\n \tuint64_t slave_protocol_features = 0;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \trte_vhost_driver_get_protocol_features(dev->ifname,\n@@ -2272,16 +2281,17 @@ vhost_user_set_protocol_features(struct virtio_net **pdev,\n }\n \n static int\n-vhost_user_set_log_base(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_set_log_base(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tint fd = msg->fds[0];\n+\tint fd = ctx->fds[0];\n \tuint64_t size, off;\n \tvoid *addr;\n \tuint32_t i;\n \n-\tif (validate_msg_fds(msg, 1) != 0)\n+\tif (validate_msg_fds(ctx, 1) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tif (fd < 0) {\n@@ -2289,15 +2299,15 @@ vhost_user_set_log_base(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \n-\tif (msg->size != sizeof(VhostUserLog)) {\n+\tif (ctx->msg.size != sizeof(VhostUserLog)) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"invalid log base msg size: %\"PRId32\" != %d\\n\",\n-\t\t\tmsg->size, (int)sizeof(VhostUserLog));\n+\t\t\tctx->msg.size, (int)sizeof(VhostUserLog));\n \t\tgoto close_msg_fds;\n \t}\n \n-\tsize = msg->payload.log.mmap_size;\n-\toff  = msg->payload.log.mmap_offset;\n+\tsize = ctx->msg.payload.log.mmap_size;\n+\toff  = ctx->msg.payload.log.mmap_offset;\n \n \t/* Check for mmap size and offset overflow. */\n \tif (off >= -size) {\n@@ -2354,24 +2364,24 @@ vhost_user_set_log_base(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t * The spec is not clear about it (yet), but QEMU doesn't expect\n \t * any payload in the reply.\n \t */\n-\tmsg->size = 0;\n-\tmsg->fd_num = 0;\n+\tctx->msg.size = 0;\n+\tctx->fd_num = 0;\n \n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n \n close_msg_fds:\n-\tclose_msg_fds(msg);\n+\tclose_msg_fds(ctx);\n \treturn RTE_VHOST_MSG_RESULT_ERR;\n }\n \n static int vhost_user_set_log_fd(struct virtio_net **pdev __rte_unused,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n-\tif (validate_msg_fds(msg, 1) != 0)\n+\tif (validate_msg_fds(ctx, 1) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n-\tclose(msg->fds[0]);\n+\tclose(ctx->fds[0]);\n \tVHOST_LOG_CONFIG(INFO, \"not implemented.\\n\");\n \n \treturn RTE_VHOST_MSG_RESULT_OK;\n@@ -2386,14 +2396,15 @@ static int vhost_user_set_log_fd(struct virtio_net **pdev __rte_unused,\n  * a flag 'broadcast_rarp' to let rte_vhost_dequeue_burst() inject it.\n  */\n static int\n-vhost_user_send_rarp(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_send_rarp(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tuint8_t *mac = (uint8_t *)&msg->payload.u64;\n+\tuint8_t *mac = (uint8_t *)&ctx->msg.payload.u64;\n \tstruct rte_vdpa_device *vdpa_dev;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tVHOST_LOG_CONFIG(DEBUG,\n@@ -2417,35 +2428,37 @@ vhost_user_send_rarp(struct virtio_net **pdev, struct VhostUserMsg *msg,\n }\n \n static int\n-vhost_user_net_set_mtu(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_net_set_mtu(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n-\tif (msg->payload.u64 < VIRTIO_MIN_MTU ||\n-\t\t\tmsg->payload.u64 > VIRTIO_MAX_MTU) {\n+\tif (ctx->msg.payload.u64 < VIRTIO_MIN_MTU ||\n+\t\t\tctx->msg.payload.u64 > VIRTIO_MAX_MTU) {\n \t\tVHOST_LOG_CONFIG(ERR, \"Invalid MTU size (%\"PRIu64\")\\n\",\n-\t\t\t\tmsg->payload.u64);\n+\t\t\t\tctx->msg.payload.u64);\n \n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \n-\tdev->mtu = msg->payload.u64;\n+\tdev->mtu = ctx->msg.payload.u64;\n \n \treturn RTE_VHOST_MSG_RESULT_OK;\n }\n \n static int\n-vhost_user_set_req_fd(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_set_req_fd(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tint fd = msg->fds[0];\n+\tint fd = ctx->fds[0];\n \n-\tif (validate_msg_fds(msg, 1) != 0)\n+\tif (validate_msg_fds(ctx, 1) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tif (fd < 0) {\n@@ -2539,15 +2552,16 @@ static int is_vring_iotlb(struct virtio_net *dev,\n }\n \n static int\n-vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_iotlb_msg(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n-\tstruct vhost_iotlb_msg *imsg = &msg->payload.iotlb;\n+\tstruct vhost_iotlb_msg *imsg = &ctx->msg.payload.iotlb;\n \tuint16_t i;\n \tuint64_t vva, len;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tswitch (imsg->type) {\n@@ -2595,14 +2609,14 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \n static int\n vhost_user_set_postcopy_advise(struct virtio_net **pdev,\n-\t\t\tstruct VhostUserMsg *msg,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n #ifdef RTE_LIBRTE_VHOST_POSTCOPY\n \tstruct uffdio_api api_struct;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tdev->postcopy_ufd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n@@ -2621,13 +2635,13 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,\n \t\tdev->postcopy_ufd = -1;\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n-\tmsg->fds[0] = dev->postcopy_ufd;\n-\tmsg->fd_num = 1;\n+\tctx->fds[0] = dev->postcopy_ufd;\n+\tctx->fd_num = 1;\n \n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n #else\n \tdev->postcopy_ufd = -1;\n-\tmsg->fd_num = 0;\n+\tctx->fd_num = 0;\n \n \treturn RTE_VHOST_MSG_RESULT_ERR;\n #endif\n@@ -2635,12 +2649,12 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,\n \n static int\n vhost_user_set_postcopy_listen(struct virtio_net **pdev,\n-\t\t\tstruct VhostUserMsg *msg __rte_unused,\n+\t\t\tstruct vhu_msg_context *ctx __rte_unused,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tif (dev->mem && dev->mem->nregions) {\n@@ -2654,12 +2668,13 @@ vhost_user_set_postcopy_listen(struct virtio_net **pdev,\n }\n \n static int\n-vhost_user_postcopy_end(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_postcopy_end(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \tdev->postcopy_listening = 0;\n@@ -2668,46 +2683,48 @@ vhost_user_postcopy_end(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t\tdev->postcopy_ufd = -1;\n \t}\n \n-\tmsg->payload.u64 = 0;\n-\tmsg->size = sizeof(msg->payload.u64);\n-\tmsg->fd_num = 0;\n+\tctx->msg.payload.u64 = 0;\n+\tctx->msg.size = sizeof(ctx->msg.payload.u64);\n+\tctx->fd_num = 0;\n \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+vhost_user_get_status(struct virtio_net **pdev,\n+\t\t      struct vhu_msg_context *ctx,\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+\tif (validate_msg_fds(ctx, 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+\tctx->msg.payload.u64 = dev->status;\n+\tctx->msg.size = sizeof(ctx->msg.payload.u64);\n+\tctx->fd_num = 0;\n \n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n }\n \n static int\n-vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+vhost_user_set_status(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n {\n \tstruct virtio_net *dev = *pdev;\n \n-\tif (validate_msg_fds(msg, 0) != 0)\n+\tif (validate_msg_fds(ctx, 0) != 0)\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \n \t/* As per Virtio specification, the device status is 8bits long */\n-\tif (msg->payload.u64 > UINT8_MAX) {\n+\tif (ctx->msg.payload.u64 > UINT8_MAX) {\n \t\tVHOST_LOG_CONFIG(ERR, \"Invalid VHOST_USER_SET_STATUS payload 0x%\" PRIx64 \"\\n\",\n-\t\t\t\tmsg->payload.u64);\n+\t\t\t\tctx->msg.payload.u64);\n \t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \n-\tdev->status = msg->payload.u64;\n+\tdev->status = ctx->msg.payload.u64;\n \n \tif ((dev->status & VIRTIO_DEVICE_STATUS_FEATURES_OK) &&\n \t    (dev->flags & VIRTIO_DEV_FEATURES_FAILED)) {\n@@ -2740,8 +2757,9 @@ vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg,\n }\n \n typedef int (*vhost_message_handler_t)(struct virtio_net **pdev,\n-\t\t\t\t\tstruct VhostUserMsg *msg,\n+\t\t\t\t\tstruct vhu_msg_context *ctx,\n \t\t\t\t\tint main_fd);\n+\n static vhost_message_handler_t vhost_message_handlers[VHOST_USER_MAX] = {\n \t[VHOST_USER_NONE] = NULL,\n \t[VHOST_USER_GET_FEATURES] = vhost_user_get_features,\n@@ -2777,30 +2795,30 @@ static vhost_message_handler_t vhost_message_handlers[VHOST_USER_MAX] = {\n \n /* return bytes# of read on success or negative val on failure. */\n static int\n-read_vhost_message(int sockfd, struct VhostUserMsg *msg)\n+read_vhost_message(int sockfd, struct vhu_msg_context *ctx)\n {\n \tint ret;\n \n-\tret = read_fd_message(sockfd, (char *)msg, VHOST_USER_HDR_SIZE,\n-\t\tmsg->fds, VHOST_MEMORY_MAX_NREGIONS, &msg->fd_num);\n+\tret = read_fd_message(sockfd, (char *)&ctx->msg, VHOST_USER_HDR_SIZE,\n+\t\tctx->fds, VHOST_MEMORY_MAX_NREGIONS, &ctx->fd_num);\n \tif (ret <= 0) {\n \t\treturn ret;\n \t} else if (ret != VHOST_USER_HDR_SIZE) {\n \t\tVHOST_LOG_CONFIG(ERR, \"Unexpected header size read\\n\");\n-\t\tclose_msg_fds(msg);\n+\t\tclose_msg_fds(ctx);\n \t\treturn -1;\n \t}\n \n-\tif (msg->size) {\n-\t\tif (msg->size > sizeof(msg->payload)) {\n+\tif (ctx->msg.size) {\n+\t\tif (ctx->msg.size > sizeof(ctx->msg.payload)) {\n \t\t\tVHOST_LOG_CONFIG(ERR,\n-\t\t\t\t\"invalid msg size: %d\\n\", msg->size);\n+\t\t\t\t\"invalid msg size: %d\\n\", ctx->msg.size);\n \t\t\treturn -1;\n \t\t}\n-\t\tret = read(sockfd, &msg->payload, msg->size);\n+\t\tret = read(sockfd, &ctx->msg.payload, ctx->msg.size);\n \t\tif (ret <= 0)\n \t\t\treturn ret;\n-\t\tif (ret != (int)msg->size) {\n+\t\tif (ret != (int)ctx->msg.size) {\n \t\t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\t\"read control message failed\\n\");\n \t\t\treturn -1;\n@@ -2811,39 +2829,40 @@ read_vhost_message(int sockfd, struct VhostUserMsg *msg)\n }\n \n static int\n-send_vhost_message(int sockfd, struct VhostUserMsg *msg)\n+send_vhost_message(int sockfd, struct vhu_msg_context *ctx)\n {\n-\tif (!msg)\n+\tif (!ctx)\n \t\treturn 0;\n \n-\treturn send_fd_message(sockfd, (char *)msg,\n-\t\tVHOST_USER_HDR_SIZE + msg->size, msg->fds, msg->fd_num);\n+\treturn send_fd_message(sockfd, (char *)&ctx->msg,\n+\t\tVHOST_USER_HDR_SIZE + ctx->msg.size, ctx->fds, ctx->fd_num);\n }\n \n static int\n-send_vhost_reply(int sockfd, struct VhostUserMsg *msg)\n+send_vhost_reply(int sockfd, struct vhu_msg_context *ctx)\n {\n-\tif (!msg)\n+\tif (!ctx)\n \t\treturn 0;\n \n-\tmsg->flags &= ~VHOST_USER_VERSION_MASK;\n-\tmsg->flags &= ~VHOST_USER_NEED_REPLY;\n-\tmsg->flags |= VHOST_USER_VERSION;\n-\tmsg->flags |= VHOST_USER_REPLY_MASK;\n+\tctx->msg.flags &= ~VHOST_USER_VERSION_MASK;\n+\tctx->msg.flags &= ~VHOST_USER_NEED_REPLY;\n+\tctx->msg.flags |= VHOST_USER_VERSION;\n+\tctx->msg.flags |= VHOST_USER_REPLY_MASK;\n \n-\treturn send_vhost_message(sockfd, msg);\n+\treturn send_vhost_message(sockfd, ctx);\n }\n \n static int\n-send_vhost_slave_message(struct virtio_net *dev, struct VhostUserMsg *msg)\n+send_vhost_slave_message(struct virtio_net *dev,\n+\t\tstruct vhu_msg_context *ctx)\n {\n \tint ret;\n \n-\tif (msg->flags & VHOST_USER_NEED_REPLY)\n+\tif (ctx->msg.flags & VHOST_USER_NEED_REPLY)\n \t\trte_spinlock_lock(&dev->slave_req_lock);\n \n-\tret = send_vhost_message(dev->slave_req_fd, msg);\n-\tif (ret < 0 && (msg->flags & VHOST_USER_NEED_REPLY))\n+\tret = send_vhost_message(dev->slave_req_fd, ctx);\n+\tif (ret < 0 && (ctx->msg.flags & VHOST_USER_NEED_REPLY))\n \t\trte_spinlock_unlock(&dev->slave_req_lock);\n \n \treturn ret;\n@@ -2854,24 +2873,24 @@ send_vhost_slave_message(struct virtio_net *dev, struct VhostUserMsg *msg)\n  */\n static int\n vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev,\n-\t\t\tstruct VhostUserMsg *msg)\n+\t\t\tstruct vhu_msg_context *ctx)\n {\n \tuint32_t vring_idx;\n \n-\tswitch (msg->request.master) {\n+\tswitch (ctx->msg.request.master) {\n \tcase VHOST_USER_SET_VRING_KICK:\n \tcase VHOST_USER_SET_VRING_CALL:\n \tcase VHOST_USER_SET_VRING_ERR:\n-\t\tvring_idx = msg->payload.u64 & VHOST_USER_VRING_IDX_MASK;\n+\t\tvring_idx = ctx->msg.payload.u64 & VHOST_USER_VRING_IDX_MASK;\n \t\tbreak;\n \tcase VHOST_USER_SET_VRING_NUM:\n \tcase VHOST_USER_SET_VRING_BASE:\n \tcase VHOST_USER_GET_VRING_BASE:\n \tcase VHOST_USER_SET_VRING_ENABLE:\n-\t\tvring_idx = msg->payload.state.index;\n+\t\tvring_idx = ctx->msg.payload.state.index;\n \t\tbreak;\n \tcase VHOST_USER_SET_VRING_ADDR:\n-\t\tvring_idx = msg->payload.addr.index;\n+\t\tvring_idx = ctx->msg.payload.addr.index;\n \t\tbreak;\n \tdefault:\n \t\treturn 0;\n@@ -2927,7 +2946,7 @@ int\n vhost_user_msg_handler(int vid, int fd)\n {\n \tstruct virtio_net *dev;\n-\tstruct VhostUserMsg msg;\n+\tstruct vhu_msg_context ctx;\n \tstruct rte_vdpa_device *vdpa_dev;\n \tint ret;\n \tint unlock_required = 0;\n@@ -2949,7 +2968,7 @@ vhost_user_msg_handler(int vid, int fd)\n \t\t}\n \t}\n \n-\tret = read_vhost_message(fd, &msg);\n+\tret = read_vhost_message(fd, &ctx);\n \tif (ret <= 0) {\n \t\tif (ret < 0)\n \t\t\tVHOST_LOG_CONFIG(ERR,\n@@ -2962,7 +2981,7 @@ vhost_user_msg_handler(int vid, int fd)\n \t}\n \n \tret = 0;\n-\trequest = msg.request.master;\n+\trequest = ctx.msg.request.master;\n \tif (request > VHOST_USER_NONE && request < VHOST_USER_MAX &&\n \t\t\tvhost_message_str[request]) {\n \t\tif (request != VHOST_USER_IOTLB_MSG)\n@@ -2975,7 +2994,7 @@ vhost_user_msg_handler(int vid, int fd)\n \t\tVHOST_LOG_CONFIG(DEBUG, \"External request %d\\n\", request);\n \t}\n \n-\tret = vhost_user_check_and_alloc_queue_pair(dev, &msg);\n+\tret = vhost_user_check_and_alloc_queue_pair(dev, &ctx);\n \tif (ret < 0) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"failed to alloc queue\\n\");\n@@ -3019,10 +3038,10 @@ vhost_user_msg_handler(int vid, int fd)\n \thandled = false;\n \tif (dev->extern_ops.pre_msg_handle) {\n \t\tret = (*dev->extern_ops.pre_msg_handle)(dev->vid,\n-\t\t\t\t(void *)&msg);\n+\t\t\t\t(void *)&ctx.msg);\n \t\tswitch (ret) {\n \t\tcase RTE_VHOST_MSG_RESULT_REPLY:\n-\t\t\tsend_vhost_reply(fd, &msg);\n+\t\t\tsend_vhost_reply(fd, &ctx);\n \t\t\t/* Fall-through */\n \t\tcase RTE_VHOST_MSG_RESULT_ERR:\n \t\tcase RTE_VHOST_MSG_RESULT_OK:\n@@ -3037,7 +3056,7 @@ vhost_user_msg_handler(int vid, int fd)\n \tif (request > VHOST_USER_NONE && request < VHOST_USER_MAX) {\n \t\tif (!vhost_message_handlers[request])\n \t\t\tgoto skip_to_post_handle;\n-\t\tret = vhost_message_handlers[request](&dev, &msg, fd);\n+\t\tret = vhost_message_handlers[request](&dev, &ctx, fd);\n \n \t\tswitch (ret) {\n \t\tcase RTE_VHOST_MSG_RESULT_ERR:\n@@ -3056,7 +3075,7 @@ vhost_user_msg_handler(int vid, int fd)\n \t\t\tVHOST_LOG_CONFIG(DEBUG,\n \t\t\t\t\"Processing %s succeeded and needs reply.\\n\",\n \t\t\t\tvhost_message_str[request]);\n-\t\t\tsend_vhost_reply(fd, &msg);\n+\t\t\tsend_vhost_reply(fd, &ctx);\n \t\t\thandled = true;\n \t\t\tbreak;\n \t\tdefault:\n@@ -3068,10 +3087,10 @@ vhost_user_msg_handler(int vid, int fd)\n \tif (ret != RTE_VHOST_MSG_RESULT_ERR &&\n \t\t\tdev->extern_ops.post_msg_handle) {\n \t\tret = (*dev->extern_ops.post_msg_handle)(dev->vid,\n-\t\t\t\t(void *)&msg);\n+\t\t\t\t(void *)&ctx.msg);\n \t\tswitch (ret) {\n \t\tcase RTE_VHOST_MSG_RESULT_REPLY:\n-\t\t\tsend_vhost_reply(fd, &msg);\n+\t\t\tsend_vhost_reply(fd, &ctx);\n \t\t\t/* Fall-through */\n \t\tcase RTE_VHOST_MSG_RESULT_ERR:\n \t\tcase RTE_VHOST_MSG_RESULT_OK:\n@@ -3086,7 +3105,7 @@ vhost_user_msg_handler(int vid, int fd)\n \tif (!handled) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"vhost message (req: %d) was not handled.\\n\", request);\n-\t\tclose_msg_fds(&msg);\n+\t\tclose_msg_fds(&ctx);\n \t\tret = RTE_VHOST_MSG_RESULT_ERR;\n \t}\n \n@@ -3095,11 +3114,11 @@ vhost_user_msg_handler(int vid, int fd)\n \t * this optional reply-ack won't be sent as the\n \t * VHOST_USER_NEED_REPLY was cleared in send_vhost_reply().\n \t */\n-\tif (msg.flags & VHOST_USER_NEED_REPLY) {\n-\t\tmsg.payload.u64 = ret == RTE_VHOST_MSG_RESULT_ERR;\n-\t\tmsg.size = sizeof(msg.payload.u64);\n-\t\tmsg.fd_num = 0;\n-\t\tsend_vhost_reply(fd, &msg);\n+\tif (ctx.msg.flags & VHOST_USER_NEED_REPLY) {\n+\t\tctx.msg.payload.u64 = ret == RTE_VHOST_MSG_RESULT_ERR;\n+\t\tctx.msg.size = sizeof(ctx.msg.payload.u64);\n+\t\tctx.fd_num = 0;\n+\t\tsend_vhost_reply(fd, &ctx);\n \t} else if (ret == RTE_VHOST_MSG_RESULT_ERR) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"vhost message handling failed.\\n\");\n@@ -3150,12 +3169,12 @@ vhost_user_msg_handler(int vid, int fd)\n }\n \n static int process_slave_message_reply(struct virtio_net *dev,\n-\t\t\t\t       const struct VhostUserMsg *msg)\n+\t\t\t\t       const struct vhu_msg_context *ctx)\n {\n-\tstruct VhostUserMsg msg_reply;\n+\tstruct vhu_msg_context msg_reply;\n \tint ret;\n \n-\tif ((msg->flags & VHOST_USER_NEED_REPLY) == 0)\n+\tif ((ctx->msg.flags & VHOST_USER_NEED_REPLY) == 0)\n \t\treturn 0;\n \n \tret = read_vhost_message(dev->slave_req_fd, &msg_reply);\n@@ -3171,15 +3190,15 @@ static int process_slave_message_reply(struct virtio_net *dev,\n \t}\n \n \tret = 0;\n-\tif (msg_reply.request.slave != msg->request.slave) {\n+\tif (msg_reply.msg.request.slave != ctx->msg.request.slave) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"Received unexpected msg type (%u), expected %u\\n\",\n-\t\t\tmsg_reply.request.slave, msg->request.slave);\n+\t\t\tmsg_reply.msg.request.slave, ctx->msg.request.slave);\n \t\tret = -1;\n \t\tgoto out;\n \t}\n \n-\tret = msg_reply.payload.u64 ? -1 : 0;\n+\tret = msg_reply.msg.payload.u64 ? -1 : 0;\n \n out:\n \trte_spinlock_unlock(&dev->slave_req_lock);\n@@ -3190,18 +3209,20 @@ int\n vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)\n {\n \tint ret;\n-\tstruct VhostUserMsg msg = {\n-\t\t.request.slave = VHOST_USER_SLAVE_IOTLB_MSG,\n-\t\t.flags = VHOST_USER_VERSION,\n-\t\t.size = sizeof(msg.payload.iotlb),\n-\t\t.payload.iotlb = {\n-\t\t\t.iova = iova,\n-\t\t\t.perm = perm,\n-\t\t\t.type = VHOST_IOTLB_MISS,\n+\tstruct vhu_msg_context ctx = {\n+\t\t.msg = {\n+\t\t\t.request.slave = VHOST_USER_SLAVE_IOTLB_MSG,\n+\t\t\t.flags = VHOST_USER_VERSION,\n+\t\t\t.size = sizeof(ctx.msg.payload.iotlb),\n+\t\t\t.payload.iotlb = {\n+\t\t\t\t.iova = iova,\n+\t\t\t\t.perm = perm,\n+\t\t\t\t.type = VHOST_IOTLB_MISS,\n+\t\t\t},\n \t\t},\n \t};\n \n-\tret = send_vhost_message(dev->slave_req_fd, &msg);\n+\tret = send_vhost_message(dev->slave_req_fd, &ctx);\n \tif (ret < 0) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\t\"Failed to send IOTLB miss message (%d)\\n\",\n@@ -3216,16 +3237,18 @@ static int\n vhost_user_slave_config_change(struct virtio_net *dev, bool need_reply)\n {\n \tint ret;\n-\tstruct VhostUserMsg msg = {\n-\t\t.request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,\n-\t\t.flags = VHOST_USER_VERSION,\n-\t\t.size = 0,\n+\tstruct vhu_msg_context ctx = {\n+\t\t.msg = {\n+\t\t\t.request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,\n+\t\t\t.flags = VHOST_USER_VERSION,\n+\t\t\t.size = 0,\n+\t\t}\n \t};\n \n \tif (need_reply)\n-\t\tmsg.flags |= VHOST_USER_NEED_REPLY;\n+\t\tctx.msg.flags |= VHOST_USER_NEED_REPLY;\n \n-\tret = send_vhost_slave_message(dev, &msg);\n+\tret = send_vhost_slave_message(dev, &ctx);\n \tif (ret < 0) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\t\"Failed to send config change (%d)\\n\",\n@@ -3233,7 +3256,7 @@ vhost_user_slave_config_change(struct virtio_net *dev, bool need_reply)\n \t\treturn ret;\n \t}\n \n-\treturn process_slave_message_reply(dev, &msg);\n+\treturn process_slave_message_reply(dev, &ctx);\n }\n \n int\n@@ -3254,32 +3277,34 @@ static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,\n \t\t\t\t\t\t    uint64_t size)\n {\n \tint ret;\n-\tstruct VhostUserMsg msg = {\n-\t\t.request.slave = VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG,\n-\t\t.flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY,\n-\t\t.size = sizeof(msg.payload.area),\n-\t\t.payload.area = {\n-\t\t\t.u64 = index & VHOST_USER_VRING_IDX_MASK,\n-\t\t\t.size = size,\n-\t\t\t.offset = offset,\n+\tstruct vhu_msg_context ctx = {\n+\t\t.msg = {\n+\t\t\t.request.slave = VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG,\n+\t\t\t.flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY,\n+\t\t\t.size = sizeof(ctx.msg.payload.area),\n+\t\t\t.payload.area = {\n+\t\t\t\t.u64 = index & VHOST_USER_VRING_IDX_MASK,\n+\t\t\t\t.size = size,\n+\t\t\t\t.offset = offset,\n+\t\t\t},\n \t\t},\n \t};\n \n \tif (fd < 0)\n-\t\tmsg.payload.area.u64 |= VHOST_USER_VRING_NOFD_MASK;\n+\t\tctx.msg.payload.area.u64 |= VHOST_USER_VRING_NOFD_MASK;\n \telse {\n-\t\tmsg.fds[0] = fd;\n-\t\tmsg.fd_num = 1;\n+\t\tctx.fds[0] = fd;\n+\t\tctx.fd_num = 1;\n \t}\n \n-\tret = send_vhost_slave_message(dev, &msg);\n+\tret = send_vhost_slave_message(dev, &ctx);\n \tif (ret < 0) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"Failed to set host notifier (%d)\\n\", ret);\n \t\treturn ret;\n \t}\n \n-\treturn process_slave_message_reply(dev, &msg);\n+\treturn process_slave_message_reply(dev, &ctx);\n }\n \n int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable)\ndiff --git a/lib/vhost/vhost_user.h b/lib/vhost/vhost_user.h\nindex 16fe03f889..9314fd3d07 100644\n--- a/lib/vhost/vhost_user.h\n+++ b/lib/vhost/vhost_user.h\n@@ -149,9 +149,14 @@ typedef struct VhostUserMsg {\n \t\tVhostUserVringArea area;\n \t\tVhostUserInflight inflight;\n \t} payload;\n+\t/* Nothing should be added after the payload */\n+} __rte_packed VhostUserMsg;\n+\n+struct vhu_msg_context {\n \tint fds[VHOST_MEMORY_MAX_NREGIONS];\n \tint fd_num;\n-} __rte_packed VhostUserMsg;\n+\tVhostUserMsg msg;\n+};\n \n #define VHOST_USER_HDR_SIZE offsetof(VhostUserMsg, payload.u64)\n \n",
    "prefixes": [
        "1/1"
    ]
}