struct VhostUserMsg *msg __rte_unused,
int main_fd __rte_unused)
{
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
cleanup_device(dev, 0);
reset_device(dev);
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
/*
msg->size = sizeof(msg->payload.u64);
msg->fd_num = 0;
- return VH_RESULT_REPLY;
+ return RTE_VHOST_MSG_RESULT_REPLY;
}
/*
msg->size = sizeof(msg->payload.u64);
msg->fd_num = 0;
- return VH_RESULT_REPLY;
+ return RTE_VHOST_MSG_RESULT_REPLY;
}
/*
RTE_LOG(ERR, VHOST_CONFIG,
"(%d) received invalid negotiated features.\n",
dev->vid);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
if (dev->flags & VIRTIO_DEV_RUNNING) {
if (dev->features == features)
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
/*
* Error out if master tries to change features while device is
RTE_LOG(ERR, VHOST_CONFIG,
"(%d) features changed while device is running.\n",
dev->vid);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
if (dev->notify_ops->features_changed)
if (vdpa_dev && vdpa_dev->ops->set_features)
vdpa_dev->ops->set_features(dev->vid);
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
/*
if ((vq->size & (vq->size - 1)) || vq->size > 32768) {
RTE_LOG(ERR, VHOST_CONFIG,
"invalid virtqueue size %u\n", vq->size);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
if (dev->dequeue_zero_copy) {
if (!vq->shadow_used_packed) {
RTE_LOG(ERR, VHOST_CONFIG,
"failed to allocate memory for shadow used ring.\n");
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
} else {
if (!vq->shadow_used_split) {
RTE_LOG(ERR, VHOST_CONFIG,
"failed to allocate memory for shadow used ring.\n");
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
}
if (!vq->batch_copy_elems) {
RTE_LOG(ERR, VHOST_CONFIG,
"failed to allocate memory for batching copy.\n");
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
/*
struct vhost_vring_addr *addr = &msg->payload.addr;
if (dev->mem == NULL)
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
/* addr->index refers to the queue index. The txq 1, rxq is 0. */
vq = dev->virtqueue[msg->payload.addr.index];
(1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) {
dev = translate_ring_addresses(dev, msg->payload.addr.index);
if (!dev)
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
*pdev = dev;
}
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
/*
vq->last_avail_idx = msg->payload.state.num;
}
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
if (memory->nregions > VHOST_MEMORY_MAX_NREGIONS) {
RTE_LOG(ERR, VHOST_CONFIG,
"too many memory regions (%u)\n", memory->nregions);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
if (dev->mem && !vhost_memory_changed(memory, dev->mem)) {
for (i = 0; i < memory->nregions; i++)
close(msg->fds[i]);
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
if (dev->mem) {
"(%d) failed to allocate memory "
"for dev->guest_pages\n",
dev->vid);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
}
RTE_LOG(ERR, VHOST_CONFIG,
"(%d) failed to allocate memory for dev->mem\n",
dev->vid);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
dev->mem->nregions = memory->nregions;
dump_guest_pages(dev);
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
err_mmap:
free_mem_region(dev);
rte_free(dev->mem);
dev->mem = NULL;
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
static bool
vq->callfd = file.fd;
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int vhost_user_set_vring_err(struct virtio_net **pdev __rte_unused,
close(msg->fds[0]);
RTE_LOG(INFO, VHOST_CONFIG, "not implemented\n");
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
/* Interpret ring addresses only when ring is started. */
dev = translate_ring_addresses(dev, file.index);
if (!dev)
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
*pdev = dev;
close(vq->kickfd);
vq->kickfd = file.fd;
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static void
msg->size = sizeof(msg->payload.state);
msg->fd_num = 0;
- return VH_RESULT_REPLY;
+ return RTE_VHOST_MSG_RESULT_REPLY;
}
/*
dev->virtqueue[index]->enabled = enable;
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
msg->size = sizeof(msg->payload.u64);
msg->fd_num = 0;
- return VH_RESULT_REPLY;
+ return RTE_VHOST_MSG_RESULT_REPLY;
}
static int
RTE_LOG(ERR, VHOST_CONFIG,
"(%d) received invalid protocol features.\n",
dev->vid);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
dev->protocol_features = protocol_features;
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
if (fd < 0) {
RTE_LOG(ERR, VHOST_CONFIG, "invalid log fd: %d\n", fd);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
if (msg->size != sizeof(VhostUserLog)) {
RTE_LOG(ERR, VHOST_CONFIG,
"invalid log base msg size: %"PRId32" != %d\n",
msg->size, (int)sizeof(VhostUserLog));
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
size = msg->payload.log.mmap_size;
RTE_LOG(ERR, VHOST_CONFIG,
"log offset %#"PRIx64" exceeds log size %#"PRIx64"\n",
off, size);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
RTE_LOG(INFO, VHOST_CONFIG,
close(fd);
if (addr == MAP_FAILED) {
RTE_LOG(ERR, VHOST_CONFIG, "mmap log base failed!\n");
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
/*
msg->size = 0;
msg->fd_num = 0;
- return VH_RESULT_REPLY;
+ return RTE_VHOST_MSG_RESULT_REPLY;
}
static int vhost_user_set_log_fd(struct virtio_net **pdev __rte_unused,
close(msg->fds[0]);
RTE_LOG(INFO, VHOST_CONFIG, "not implemented.\n");
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
/*
if (vdpa_dev && vdpa_dev->ops->migration_done)
vdpa_dev->ops->migration_done(dev->vid);
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
RTE_LOG(ERR, VHOST_CONFIG, "Invalid MTU size (%"PRIu64")\n",
msg->payload.u64);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
dev->mtu = msg->payload.u64;
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
RTE_LOG(ERR, VHOST_CONFIG,
"Invalid file descriptor for slave channel (%d)\n",
fd);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
dev->slave_req_fd = fd;
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
len = imsg->size;
vva = qva_to_vva(dev, imsg->uaddr, &len);
if (!vva)
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
for (i = 0; i < dev->nr_vring; i++) {
struct vhost_virtqueue *vq = dev->virtqueue[i];
default:
RTE_LOG(ERR, VHOST_CONFIG, "Invalid IOTLB message type (%d)\n",
imsg->type);
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
if (dev->postcopy_ufd == -1) {
RTE_LOG(ERR, VHOST_CONFIG, "Userfaultfd not available: %s\n",
strerror(errno));
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
api_struct.api = UFFD_API;
api_struct.features = 0;
strerror(errno));
close(dev->postcopy_ufd);
dev->postcopy_ufd = -1;
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
msg->fds[0] = dev->postcopy_ufd;
msg->fd_num = 1;
- return VH_RESULT_REPLY;
+ return RTE_VHOST_MSG_RESULT_REPLY;
#else
dev->postcopy_ufd = -1;
msg->fd_num = 0;
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
#endif
}
if (dev->mem && dev->mem->nregions) {
RTE_LOG(ERR, VHOST_CONFIG,
"Regions already registered at postcopy-listen\n");
- return VH_RESULT_ERR;
+ return RTE_VHOST_MSG_RESULT_ERR;
}
dev->postcopy_listening = 1;
- return VH_RESULT_OK;
+ return RTE_VHOST_MSG_RESULT_OK;
}
static int
msg->size = sizeof(msg->payload.u64);
msg->fd_num = 0;
- return VH_RESULT_REPLY;
+ return RTE_VHOST_MSG_RESULT_REPLY;
}
typedef int (*vhost_message_handler_t)(struct virtio_net **pdev,
if (dev->extern_ops.pre_msg_handle) {
ret = (*dev->extern_ops.pre_msg_handle)(dev->vid,
(void *)&msg, &skip_master);
- if (ret == VH_RESULT_ERR)
+ if (ret == RTE_VHOST_MSG_RESULT_ERR)
goto skip_to_reply;
- else if (ret == VH_RESULT_REPLY)
+ else if (ret == RTE_VHOST_MSG_RESULT_REPLY)
send_vhost_reply(fd, &msg);
if (skip_master)
ret = vhost_message_handlers[request](&dev, &msg, fd);
switch (ret) {
- case VH_RESULT_ERR:
+ case RTE_VHOST_MSG_RESULT_ERR:
RTE_LOG(ERR, VHOST_CONFIG,
"Processing %s failed.\n",
vhost_message_str[request]);
break;
- case VH_RESULT_OK:
+ case RTE_VHOST_MSG_RESULT_OK:
RTE_LOG(DEBUG, VHOST_CONFIG,
"Processing %s succeeded.\n",
vhost_message_str[request]);
break;
- case VH_RESULT_REPLY:
+ case RTE_VHOST_MSG_RESULT_REPLY:
RTE_LOG(DEBUG, VHOST_CONFIG,
"Processing %s succeeded and needs reply.\n",
vhost_message_str[request]);
} else {
RTE_LOG(ERR, VHOST_CONFIG,
"Requested invalid message type %d.\n", request);
- ret = VH_RESULT_ERR;
+ ret = RTE_VHOST_MSG_RESULT_ERR;
}
skip_to_post_handle:
- if (ret != VH_RESULT_ERR && dev->extern_ops.post_msg_handle) {
+ if (ret != RTE_VHOST_MSG_RESULT_ERR &&
+ dev->extern_ops.post_msg_handle) {
ret = (*dev->extern_ops.post_msg_handle)(
dev->vid, (void *)&msg);
- if (ret == VH_RESULT_ERR)
+ if (ret == RTE_VHOST_MSG_RESULT_ERR)
goto skip_to_reply;
- else if (ret == VH_RESULT_REPLY)
+ else if (ret == RTE_VHOST_MSG_RESULT_REPLY)
send_vhost_reply(fd, &msg);
}
* VHOST_USER_NEED_REPLY was cleared in send_vhost_reply().
*/
if (msg.flags & VHOST_USER_NEED_REPLY) {
- msg.payload.u64 = ret == VH_RESULT_ERR;
+ msg.payload.u64 = ret == RTE_VHOST_MSG_RESULT_ERR;
msg.size = sizeof(msg.payload.u64);
msg.fd_num = 0;
send_vhost_reply(fd, &msg);
- } else if (ret == VH_RESULT_ERR) {
+ } else if (ret == RTE_VHOST_MSG_RESULT_ERR) {
RTE_LOG(ERR, VHOST_CONFIG,
"vhost message handling failed.\n");
return -1;