From nobody Sun Oct 26 01:38:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516078934264378.37193352326665; Mon, 15 Jan 2018 21:02:14 -0800 (PST) Received: from localhost ([::1]:35313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebJO1-0003RK-9X for importer@patchew.org; Tue, 16 Jan 2018 00:02:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebJAk-0000Uo-M1 for qemu-devel@nongnu.org; Mon, 15 Jan 2018 23:48:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebJAi-00058K-Pb for qemu-devel@nongnu.org; Mon, 15 Jan 2018 23:48:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56050) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ebJAi-00057k-Es for qemu-devel@nongnu.org; Mon, 15 Jan 2018 23:48:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83E9887628; Tue, 16 Jan 2018 04:48:27 +0000 (UTC) Received: from redhat.com (ovpn-125-221.rdu2.redhat.com [10.10.125.221]) by smtp.corp.redhat.com (Postfix) with SMTP id 0CDE4E9943; Tue, 16 Jan 2018 04:48:26 +0000 (UTC) Date: Tue, 16 Jan 2018 06:48:26 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1516077852-7974-32-git-send-email-mst@redhat.com> References: <1516077852-7974-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1516077852-7974-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 16 Jan 2018 04:48:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 31/33] vhost-user: factor out msg head and payload X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" split header and payload into separate structures, to enable easier handling of alignment issues. Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 198 +++++++++++++++++++++++++--------------------= ---- 1 file changed, 101 insertions(+), 97 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 8b94688..6ac3610 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -112,7 +112,7 @@ static VhostUserConfig c __attribute__ ((unused)); + sizeof(c.size) \ + sizeof(c.flags)) =20 -typedef struct VhostUserMsg { +typedef struct { VhostUserRequest request; =20 #define VHOST_USER_VERSION_MASK (0x3) @@ -120,7 +120,9 @@ typedef struct VhostUserMsg { #define VHOST_USER_NEED_REPLY_MASK (0x1 << 3) uint32_t flags; uint32_t size; /* the following payload size */ - union { +} QEMU_PACKED VhostUserHeader; + +typedef union { #define VHOST_USER_VRING_IDX_MASK (0xff) #define VHOST_USER_VRING_NOFD_MASK (0x1<<8) uint64_t u64; @@ -130,15 +132,17 @@ typedef struct VhostUserMsg { VhostUserLog log; struct vhost_iotlb_msg iotlb; VhostUserConfig config; - } payload; +} VhostUserPayload; + +typedef struct VhostUserMsg { + VhostUserHeader hdr; + VhostUserPayload payload; } QEMU_PACKED VhostUserMsg; =20 static VhostUserMsg m __attribute__ ((unused)); -#define VHOST_USER_HDR_SIZE (sizeof(m.request) \ - + sizeof(m.flags) \ - + sizeof(m.size)) +#define VHOST_USER_HDR_SIZE (sizeof(VhostUserHeader)) =20 -#define VHOST_USER_PAYLOAD_SIZE (sizeof(m) - VHOST_USER_HDR_SIZE) +#define VHOST_USER_PAYLOAD_SIZE (sizeof(VhostUserPayload)) =20 /* The version of the protocol we support */ #define VHOST_USER_VERSION (0x1) @@ -163,33 +167,33 @@ static int vhost_user_read(struct vhost_dev *dev, Vho= stUserMsg *msg) r =3D qemu_chr_fe_read_all(chr, p, size); if (r !=3D size) { error_report("Failed to read msg header. Read %d instead of %d." - " Original request %d.", r, size, msg->request); + " Original request %d.", r, size, msg->hdr.request); goto fail; } =20 /* validate received flags */ - if (msg->flags !=3D (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) { + if (msg->hdr.flags !=3D (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) { error_report("Failed to read msg header." - " Flags 0x%x instead of 0x%x.", msg->flags, + " Flags 0x%x instead of 0x%x.", msg->hdr.flags, VHOST_USER_REPLY_MASK | VHOST_USER_VERSION); goto fail; } =20 /* validate message size is sane */ - if (msg->size > VHOST_USER_PAYLOAD_SIZE) { + if (msg->hdr.size > VHOST_USER_PAYLOAD_SIZE) { error_report("Failed to read msg header." - " Size %d exceeds the maximum %zu.", msg->size, + " Size %d exceeds the maximum %zu.", msg->hdr.size, VHOST_USER_PAYLOAD_SIZE); goto fail; } =20 - if (msg->size) { + if (msg->hdr.size) { p +=3D VHOST_USER_HDR_SIZE; - size =3D msg->size; + size =3D msg->hdr.size; r =3D qemu_chr_fe_read_all(chr, p, size); if (r !=3D size) { error_report("Failed to read msg payload." - " Read %d instead of %d.", r, msg->size); + " Read %d instead of %d.", r, msg->hdr.size); goto fail; } } @@ -205,7 +209,7 @@ static int process_message_reply(struct vhost_dev *dev, { VhostUserMsg msg_reply; =20 - if ((msg->flags & VHOST_USER_NEED_REPLY_MASK) =3D=3D 0) { + if ((msg->hdr.flags & VHOST_USER_NEED_REPLY_MASK) =3D=3D 0) { return 0; } =20 @@ -213,10 +217,10 @@ static int process_message_reply(struct vhost_dev *de= v, return -1; } =20 - if (msg_reply.request !=3D msg->request) { + if (msg_reply.hdr.request !=3D msg->hdr.request) { error_report("Received unexpected msg type." "Expected %d received %d", - msg->request, msg_reply.request); + msg->hdr.request, msg_reply.hdr.request); return -1; } =20 @@ -243,15 +247,15 @@ static int vhost_user_write(struct vhost_dev *dev, Vh= ostUserMsg *msg, { struct vhost_user *u =3D dev->opaque; CharBackend *chr =3D u->chr; - int ret, size =3D VHOST_USER_HDR_SIZE + msg->size; + int ret, size =3D VHOST_USER_HDR_SIZE + msg->hdr.size; =20 /* * For non-vring specific requests, like VHOST_USER_SET_MEM_TABLE, * we just need send it once in the first time. For later such * request, we just ignore it. */ - if (vhost_user_one_time_request(msg->request) && dev->vq_index !=3D 0)= { - msg->flags &=3D ~VHOST_USER_NEED_REPLY_MASK; + if (vhost_user_one_time_request(msg->hdr.request) && dev->vq_index != =3D 0) { + msg->hdr.flags &=3D ~VHOST_USER_NEED_REPLY_MASK; return 0; } =20 @@ -278,11 +282,11 @@ static int vhost_user_set_log_base(struct vhost_dev *= dev, uint64_t base, bool shmfd =3D virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_LOG_SHMFD); VhostUserMsg msg =3D { - .request =3D VHOST_USER_SET_LOG_BASE, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D VHOST_USER_SET_LOG_BASE, + .hdr.flags =3D VHOST_USER_VERSION, .payload.log.mmap_size =3D log->size * sizeof(*(log->log)), .payload.log.mmap_offset =3D 0, - .size =3D sizeof(msg.payload.log), + .hdr.size =3D sizeof(msg.payload.log), }; =20 if (shmfd && log->fd !=3D -1) { @@ -294,15 +298,15 @@ static int vhost_user_set_log_base(struct vhost_dev *= dev, uint64_t base, } =20 if (shmfd) { - msg.size =3D 0; + msg.hdr.size =3D 0; if (vhost_user_read(dev, &msg) < 0) { return -1; } =20 - if (msg.request !=3D VHOST_USER_SET_LOG_BASE) { + if (msg.hdr.request !=3D VHOST_USER_SET_LOG_BASE) { error_report("Received unexpected msg type. " "Expected %d received %d", - VHOST_USER_SET_LOG_BASE, msg.request); + VHOST_USER_SET_LOG_BASE, msg.hdr.request); return -1; } } @@ -320,12 +324,12 @@ static int vhost_user_set_mem_table(struct vhost_dev = *dev, VHOST_USER_PROTOCOL_F_REPLY_= ACK); =20 VhostUserMsg msg =3D { - .request =3D VHOST_USER_SET_MEM_TABLE, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D VHOST_USER_SET_MEM_TABLE, + .hdr.flags =3D VHOST_USER_VERSION, }; =20 if (reply_supported) { - msg.flags |=3D VHOST_USER_NEED_REPLY_MASK; + msg.hdr.flags |=3D VHOST_USER_NEED_REPLY_MASK; } =20 for (i =3D 0; i < dev->mem->nregions; ++i) { @@ -355,9 +359,9 @@ static int vhost_user_set_mem_table(struct vhost_dev *d= ev, return -1; } =20 - msg.size =3D sizeof(msg.payload.memory.nregions); - msg.size +=3D sizeof(msg.payload.memory.padding); - msg.size +=3D fd_num * sizeof(VhostUserMemoryRegion); + msg.hdr.size =3D sizeof(msg.payload.memory.nregions); + msg.hdr.size +=3D sizeof(msg.payload.memory.padding); + msg.hdr.size +=3D fd_num * sizeof(VhostUserMemoryRegion); =20 if (vhost_user_write(dev, &msg, fds, fd_num) < 0) { return -1; @@ -374,10 +378,10 @@ static int vhost_user_set_vring_addr(struct vhost_dev= *dev, struct vhost_vring_addr *addr) { VhostUserMsg msg =3D { - .request =3D VHOST_USER_SET_VRING_ADDR, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D VHOST_USER_SET_VRING_ADDR, + .hdr.flags =3D VHOST_USER_VERSION, .payload.addr =3D *addr, - .size =3D sizeof(msg.payload.addr), + .hdr.size =3D sizeof(msg.payload.addr), }; =20 if (vhost_user_write(dev, &msg, NULL, 0) < 0) { @@ -393,10 +397,10 @@ static int vhost_user_set_vring_endian(struct vhost_d= ev *dev, bool cross_endian =3D virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_CROSS_END= IAN); VhostUserMsg msg =3D { - .request =3D VHOST_USER_SET_VRING_ENDIAN, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D VHOST_USER_SET_VRING_ENDIAN, + .hdr.flags =3D VHOST_USER_VERSION, .payload.state =3D *ring, - .size =3D sizeof(msg.payload.state), + .hdr.size =3D sizeof(msg.payload.state), }; =20 if (!cross_endian) { @@ -416,10 +420,10 @@ static int vhost_set_vring(struct vhost_dev *dev, struct vhost_vring_state *ring) { VhostUserMsg msg =3D { - .request =3D request, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D request, + .hdr.flags =3D VHOST_USER_VERSION, .payload.state =3D *ring, - .size =3D sizeof(msg.payload.state), + .hdr.size =3D sizeof(msg.payload.state), }; =20 if (vhost_user_write(dev, &msg, NULL, 0) < 0) { @@ -465,10 +469,10 @@ static int vhost_user_get_vring_base(struct vhost_dev= *dev, struct vhost_vring_state *ring) { VhostUserMsg msg =3D { - .request =3D VHOST_USER_GET_VRING_BASE, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D VHOST_USER_GET_VRING_BASE, + .hdr.flags =3D VHOST_USER_VERSION, .payload.state =3D *ring, - .size =3D sizeof(msg.payload.state), + .hdr.size =3D sizeof(msg.payload.state), }; =20 if (vhost_user_write(dev, &msg, NULL, 0) < 0) { @@ -479,13 +483,13 @@ static int vhost_user_get_vring_base(struct vhost_dev= *dev, return -1; } =20 - if (msg.request !=3D VHOST_USER_GET_VRING_BASE) { + if (msg.hdr.request !=3D VHOST_USER_GET_VRING_BASE) { error_report("Received unexpected msg type. Expected %d received %= d", - VHOST_USER_GET_VRING_BASE, msg.request); + VHOST_USER_GET_VRING_BASE, msg.hdr.request); return -1; } =20 - if (msg.size !=3D sizeof(msg.payload.state)) { + if (msg.hdr.size !=3D sizeof(msg.payload.state)) { error_report("Received bad msg size."); return -1; } @@ -502,10 +506,10 @@ static int vhost_set_vring_file(struct vhost_dev *dev, int fds[VHOST_MEMORY_MAX_NREGIONS]; size_t fd_num =3D 0; VhostUserMsg msg =3D { - .request =3D request, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D request, + .hdr.flags =3D VHOST_USER_VERSION, .payload.u64 =3D file->index & VHOST_USER_VRING_IDX_MASK, - .size =3D sizeof(msg.payload.u64), + .hdr.size =3D sizeof(msg.payload.u64), }; =20 if (ioeventfd_enabled() && file->fd > 0) { @@ -536,10 +540,10 @@ static int vhost_user_set_vring_call(struct vhost_dev= *dev, static int vhost_user_set_u64(struct vhost_dev *dev, int request, uint64_t= u64) { VhostUserMsg msg =3D { - .request =3D request, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D request, + .hdr.flags =3D VHOST_USER_VERSION, .payload.u64 =3D u64, - .size =3D sizeof(msg.payload.u64), + .hdr.size =3D sizeof(msg.payload.u64), }; =20 if (vhost_user_write(dev, &msg, NULL, 0) < 0) { @@ -564,8 +568,8 @@ static int vhost_user_set_protocol_features(struct vhos= t_dev *dev, static int vhost_user_get_u64(struct vhost_dev *dev, int request, uint64_t= *u64) { VhostUserMsg msg =3D { - .request =3D request, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D request, + .hdr.flags =3D VHOST_USER_VERSION, }; =20 if (vhost_user_one_time_request(request) && dev->vq_index !=3D 0) { @@ -580,13 +584,13 @@ static int vhost_user_get_u64(struct vhost_dev *dev, = int request, uint64_t *u64) return -1; } =20 - if (msg.request !=3D request) { + if (msg.hdr.request !=3D request) { error_report("Received unexpected msg type. Expected %d received %= d", - request, msg.request); + request, msg.hdr.request); return -1; } =20 - if (msg.size !=3D sizeof(msg.payload.u64)) { + if (msg.hdr.size !=3D sizeof(msg.payload.u64)) { error_report("Received bad msg size."); return -1; } @@ -604,8 +608,8 @@ static int vhost_user_get_features(struct vhost_dev *de= v, uint64_t *features) static int vhost_user_set_owner(struct vhost_dev *dev) { VhostUserMsg msg =3D { - .request =3D VHOST_USER_SET_OWNER, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D VHOST_USER_SET_OWNER, + .hdr.flags =3D VHOST_USER_VERSION, }; =20 if (vhost_user_write(dev, &msg, NULL, 0) < 0) { @@ -618,8 +622,8 @@ static int vhost_user_set_owner(struct vhost_dev *dev) static int vhost_user_reset_device(struct vhost_dev *dev) { VhostUserMsg msg =3D { - .request =3D VHOST_USER_RESET_OWNER, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D VHOST_USER_RESET_OWNER, + .hdr.flags =3D VHOST_USER_VERSION, }; =20 if (vhost_user_write(dev, &msg, NULL, 0) < 0) { @@ -658,21 +662,21 @@ static void slave_read(void *opaque) goto err; } =20 - if (msg.size > VHOST_USER_PAYLOAD_SIZE) { + if (msg.hdr.size > VHOST_USER_PAYLOAD_SIZE) { error_report("Failed to read msg header." - " Size %d exceeds the maximum %zu.", msg.size, + " Size %d exceeds the maximum %zu.", msg.hdr.size, VHOST_USER_PAYLOAD_SIZE); goto err; } =20 /* Read payload */ - size =3D read(u->slave_fd, &msg.payload, msg.size); - if (size !=3D msg.size) { + size =3D read(u->slave_fd, &msg.payload, msg.hdr.size); + if (size !=3D msg.hdr.size) { error_report("Failed to read payload from slave."); goto err; } =20 - switch (msg.request) { + switch (msg.hdr.request) { case VHOST_USER_SLAVE_IOTLB_MSG: ret =3D vhost_backend_handle_iotlb_msg(dev, &msg.payload.iotlb); break; @@ -688,15 +692,15 @@ static void slave_read(void *opaque) * REPLY_ACK feature handling. Other reply types has to be managed * directly in their request handlers. */ - if (msg.flags & VHOST_USER_NEED_REPLY_MASK) { - msg.flags &=3D ~VHOST_USER_NEED_REPLY_MASK; - msg.flags |=3D VHOST_USER_REPLY_MASK; + if (msg.hdr.flags & VHOST_USER_NEED_REPLY_MASK) { + msg.hdr.flags &=3D ~VHOST_USER_NEED_REPLY_MASK; + msg.hdr.flags |=3D VHOST_USER_REPLY_MASK; =20 msg.payload.u64 =3D !!ret; - msg.size =3D sizeof(msg.payload.u64); + msg.hdr.size =3D sizeof(msg.payload.u64); =20 - size =3D write(u->slave_fd, &msg, VHOST_USER_HDR_SIZE + msg.size); - if (size !=3D VHOST_USER_HDR_SIZE + msg.size) { + size =3D write(u->slave_fd, &msg, VHOST_USER_HDR_SIZE + msg.hdr.si= ze); + if (size !=3D VHOST_USER_HDR_SIZE + msg.hdr.size) { error_report("Failed to send msg reply to slave."); goto err; } @@ -714,8 +718,8 @@ err: static int vhost_setup_slave_channel(struct vhost_dev *dev) { VhostUserMsg msg =3D { - .request =3D VHOST_USER_SET_SLAVE_REQ_FD, - .flags =3D VHOST_USER_VERSION, + .hdr.request =3D VHOST_USER_SET_SLAVE_REQ_FD, + .hdr.flags =3D VHOST_USER_VERSION, }; struct vhost_user *u =3D dev->opaque; int sv[2], ret =3D 0; @@ -736,7 +740,7 @@ static int vhost_setup_slave_channel(struct vhost_dev *= dev) qemu_set_fd_handler(u->slave_fd, slave_read, NULL, dev); =20 if (reply_supported) { - msg.flags |=3D VHOST_USER_NEED_REPLY_MASK; + msg.hdr.flags |=3D VHOST_USER_NEED_REPLY_MASK; } =20 ret =3D vhost_user_write(dev, &msg, &sv[1], 1); @@ -881,10 +885,10 @@ static int vhost_user_migration_done(struct vhost_dev= *dev, char* mac_addr) /* if backend supports VHOST_USER_PROTOCOL_F_RARP ask it to send the R= ARP */ if (virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_RARP)) { - msg.request =3D VHOST_USER_SEND_RARP; - msg.flags =3D VHOST_USER_VERSION; + msg.hdr.request =3D VHOST_USER_SEND_RARP; + msg.hdr.flags =3D VHOST_USER_VERSION; memcpy((char *)&msg.payload.u64, mac_addr, 6); - msg.size =3D sizeof(msg.payload.u64); + msg.hdr.size =3D sizeof(msg.payload.u64); =20 return vhost_user_write(dev, &msg, NULL, 0); } @@ -918,12 +922,12 @@ static int vhost_user_net_set_mtu(struct vhost_dev *d= ev, uint16_t mtu) return 0; } =20 - msg.request =3D VHOST_USER_NET_SET_MTU; + msg.hdr.request =3D VHOST_USER_NET_SET_MTU; msg.payload.u64 =3D mtu; - msg.size =3D sizeof(msg.payload.u64); - msg.flags =3D VHOST_USER_VERSION; + msg.hdr.size =3D sizeof(msg.payload.u64); + msg.hdr.flags =3D VHOST_USER_VERSION; if (reply_supported) { - msg.flags |=3D VHOST_USER_NEED_REPLY_MASK; + msg.hdr.flags |=3D VHOST_USER_NEED_REPLY_MASK; } =20 if (vhost_user_write(dev, &msg, NULL, 0) < 0) { @@ -942,9 +946,9 @@ static int vhost_user_send_device_iotlb_msg(struct vhos= t_dev *dev, struct vhost_iotlb_msg *imsg) { VhostUserMsg msg =3D { - .request =3D VHOST_USER_IOTLB_MSG, - .size =3D sizeof(msg.payload.iotlb), - .flags =3D VHOST_USER_VERSION | VHOST_USER_NEED_REPLY_MASK, + .hdr.request =3D VHOST_USER_IOTLB_MSG, + .hdr.size =3D sizeof(msg.payload.iotlb), + .hdr.flags =3D VHOST_USER_VERSION | VHOST_USER_NEED_REPLY_MASK, .payload.iotlb =3D *imsg, }; =20 @@ -965,9 +969,9 @@ static int vhost_user_get_config(struct vhost_dev *dev,= uint8_t *config, uint32_t config_len) { VhostUserMsg msg =3D { - msg.request =3D VHOST_USER_GET_CONFIG, - msg.flags =3D VHOST_USER_VERSION, - msg.size =3D VHOST_USER_CONFIG_HDR_SIZE + config_len, + .hdr.request =3D VHOST_USER_GET_CONFIG, + .hdr.flags =3D VHOST_USER_VERSION, + .hdr.size =3D VHOST_USER_CONFIG_HDR_SIZE + config_len, }; =20 if (config_len > VHOST_USER_MAX_CONFIG_SIZE) { @@ -984,13 +988,13 @@ static int vhost_user_get_config(struct vhost_dev *de= v, uint8_t *config, return -1; } =20 - if (msg.request !=3D VHOST_USER_GET_CONFIG) { + if (msg.hdr.request !=3D VHOST_USER_GET_CONFIG) { error_report("Received unexpected msg type. Expected %d received %= d", - VHOST_USER_GET_CONFIG, msg.request); + VHOST_USER_GET_CONFIG, msg.hdr.request); return -1; } =20 - if (msg.size !=3D VHOST_USER_CONFIG_HDR_SIZE + config_len) { + if (msg.hdr.size !=3D VHOST_USER_CONFIG_HDR_SIZE + config_len) { error_report("Received bad msg size."); return -1; } @@ -1008,13 +1012,13 @@ static int vhost_user_set_config(struct vhost_dev *= dev, const uint8_t *data, VHOST_USER_PROTOCOL_F_REPLY_= ACK); =20 VhostUserMsg msg =3D { - msg.request =3D VHOST_USER_SET_CONFIG, - msg.flags =3D VHOST_USER_VERSION, - msg.size =3D VHOST_USER_CONFIG_HDR_SIZE + size, + .hdr.request =3D VHOST_USER_SET_CONFIG, + .hdr.flags =3D VHOST_USER_VERSION, + .hdr.size =3D VHOST_USER_CONFIG_HDR_SIZE + size, }; =20 if (reply_supported) { - msg.flags |=3D VHOST_USER_NEED_REPLY_MASK; + msg.hdr.flags |=3D VHOST_USER_NEED_REPLY_MASK; } =20 if (size > VHOST_USER_MAX_CONFIG_SIZE) { --=20 MST