Lines Matching refs:msg

123 static int vhost_user_recv_header(int fd, struct vhost_user_msg *msg)  in vhost_user_recv_header()  argument
125 return full_read(fd, msg, sizeof(msg->header), true); in vhost_user_recv_header()
129 int fd, struct vhost_user_msg *msg, in vhost_user_recv() argument
150 rc = vhost_user_recv_header(fd, msg); in vhost_user_recv()
154 size = msg->header.size; in vhost_user_recv()
157 return full_read(fd, &msg->payload, size, false); in vhost_user_recv()
177 struct vhost_user_msg *msg, in vhost_user_recv_resp() argument
180 int rc = vhost_user_recv(vu_dev, vu_dev->sock, msg, in vhost_user_recv_resp()
188 if (msg->header.flags != (VHOST_USER_FLAG_REPLY | VHOST_USER_VERSION)) in vhost_user_recv_resp()
197 struct vhost_user_msg msg; in vhost_user_recv_u64() local
198 int rc = vhost_user_recv_resp(vu_dev, &msg, in vhost_user_recv_u64()
199 sizeof(msg.payload.integer)); in vhost_user_recv_u64()
203 if (msg.header.size != sizeof(msg.payload.integer)) in vhost_user_recv_u64()
205 *value = msg.payload.integer; in vhost_user_recv_u64()
210 struct vhost_user_msg *msg, in vhost_user_recv_req() argument
213 int rc = vhost_user_recv(vu_dev, vu_dev->req_fd, msg, in vhost_user_recv_req()
219 if ((msg->header.flags & ~VHOST_USER_FLAG_NEED_REPLY) != in vhost_user_recv_req()
227 bool need_response, struct vhost_user_msg *msg, in vhost_user_send() argument
230 size_t size = sizeof(msg->header) + msg->header.size; in vhost_user_send()
235 msg->header.flags |= VHOST_USER_VERSION; in vhost_user_send()
248 msg->header.flags |= VHOST_USER_FLAG_NEED_REPLY; in vhost_user_send()
251 rc = full_sendmsg_fds(vu_dev->sock, msg, size, fds, num_fds); in vhost_user_send()
277 struct vhost_user_msg msg = { in vhost_user_send_no_payload() local
281 return vhost_user_send(vu_dev, need_response, &msg, NULL, 0); in vhost_user_send_no_payload()
287 struct vhost_user_msg msg = { in vhost_user_send_no_payload_fd() local
291 return vhost_user_send(vu_dev, false, &msg, &fd, 1); in vhost_user_send_no_payload_fd()
297 struct vhost_user_msg msg = { in vhost_user_send_u64() local
299 .header.size = sizeof(msg.payload.integer), in vhost_user_send_u64()
303 return vhost_user_send(vu_dev, false, &msg, NULL, 0); in vhost_user_send_u64()
347 struct vhost_user_msg *msg, int response) in vhost_user_reply() argument
355 reply.header = msg->header; in vhost_user_reply()
374 struct vhost_user_msg msg; in vu_req_read_message() member
376 } msg; in vu_req_read_message() local
381 rc = vhost_user_recv_req(vu_dev, &msg.msg, in vu_req_read_message()
382 sizeof(msg.msg.payload) + in vu_req_read_message()
383 sizeof(msg.extra_payload)); in vu_req_read_message()
387 switch (msg.msg.header.request) { in vu_req_read_message()
394 if (vq->index == msg.msg.payload.vring_state.index) { in vu_req_read_message()
407 msg.msg.header.request); in vu_req_read_message()
413 if (msg.msg.header.flags & VHOST_USER_FLAG_NEED_REPLY) in vu_req_read_message()
414 vhost_user_reply(vu_dev, &msg.msg, response); in vu_req_read_message()
526 struct vhost_user_msg *msg; in vhost_user_get_config() local
527 size_t payload_size = sizeof(msg->payload.config) + cfg_size; in vhost_user_get_config()
528 size_t msg_size = sizeof(msg->header) + payload_size; in vhost_user_get_config()
535 msg = kzalloc(msg_size, GFP_KERNEL); in vhost_user_get_config()
536 if (!msg) in vhost_user_get_config()
538 msg->header.request = VHOST_USER_GET_CONFIG; in vhost_user_get_config()
539 msg->header.size = payload_size; in vhost_user_get_config()
540 msg->payload.config.offset = 0; in vhost_user_get_config()
541 msg->payload.config.size = cfg_size; in vhost_user_get_config()
543 rc = vhost_user_send(vu_dev, true, msg, NULL, 0); in vhost_user_get_config()
550 rc = vhost_user_recv_resp(vu_dev, msg, msg_size); in vhost_user_get_config()
558 if (msg->header.size != payload_size || in vhost_user_get_config()
559 msg->payload.config.size != cfg_size) { in vhost_user_get_config()
563 msg->header.size, payload_size, in vhost_user_get_config()
564 msg->payload.config.size, cfg_size); in vhost_user_get_config()
567 memcpy(buf, msg->payload.config.payload + offset, len); in vhost_user_get_config()
570 kfree(msg); in vhost_user_get_config()
576 struct vhost_user_msg *msg; in vhost_user_set_config() local
577 size_t payload_size = sizeof(msg->payload.config) + len; in vhost_user_set_config()
578 size_t msg_size = sizeof(msg->header) + payload_size; in vhost_user_set_config()
585 msg = kzalloc(msg_size, GFP_KERNEL); in vhost_user_set_config()
586 if (!msg) in vhost_user_set_config()
588 msg->header.request = VHOST_USER_SET_CONFIG; in vhost_user_set_config()
589 msg->header.size = payload_size; in vhost_user_set_config()
590 msg->payload.config.offset = offset; in vhost_user_set_config()
591 msg->payload.config.size = len; in vhost_user_set_config()
592 memcpy(msg->payload.config.payload, buf, len); in vhost_user_set_config()
594 rc = vhost_user_send(vu_dev, false, msg, NULL, 0); in vhost_user_set_config()
599 kfree(msg); in vhost_user_set_config()
626 struct vhost_user_msg msg = { in vhost_user_set_mem_table() local
628 .header.size = sizeof(msg.payload.mem_regions), in vhost_user_set_mem_table()
672 &msg.payload.mem_regions.regions[0]); in vhost_user_set_mem_table()
677 msg.payload.mem_regions.num++; in vhost_user_set_mem_table()
679 &fds[1], &msg.payload.mem_regions.regions[1]); in vhost_user_set_mem_table()
684 return vhost_user_send(vu_dev, false, &msg, fds, in vhost_user_set_mem_table()
685 msg.payload.mem_regions.num); in vhost_user_set_mem_table()
691 struct vhost_user_msg msg = { in vhost_user_set_vring_state() local
693 .header.size = sizeof(msg.payload.vring_state), in vhost_user_set_vring_state()
698 return vhost_user_send(vu_dev, false, &msg, NULL, 0); in vhost_user_set_vring_state()
719 struct vhost_user_msg msg = { in vhost_user_set_vring_addr() local
721 .header.size = sizeof(msg.payload.vring_addr), in vhost_user_set_vring_addr()
729 return vhost_user_send(vu_dev, false, &msg, NULL, 0); in vhost_user_set_vring_addr()
735 struct vhost_user_msg msg = { in vhost_user_set_vring_fd() local
737 .header.size = sizeof(msg.payload.integer), in vhost_user_set_vring_fd()
744 msg.payload.integer |= VHOST_USER_VRING_POLL_MASK; in vhost_user_set_vring_fd()
745 return vhost_user_send(vu_dev, false, &msg, NULL, 0); in vhost_user_set_vring_fd()
747 return vhost_user_send(vu_dev, false, &msg, &fd, 1); in vhost_user_set_vring_fd()