struct sockaddr_un un;
bool is_server;
bool reconnect;
- bool dequeue_zero_copy;
bool iommu_support;
bool use_builtin_virtio_net;
bool extbuf;
bool linearbuf;
+ bool async_copy;
/*
* The "supported_features" indicates the feature bits the
size_t size;
struct vhost_user_connection *conn;
int ret;
+ struct virtio_net *dev;
if (vsocket == NULL)
return;
vhost_attach_vdpa_device(vid, vsocket->vdpa_dev);
- if (vsocket->dequeue_zero_copy)
- vhost_enable_dequeue_zero_copy(vid);
-
if (vsocket->extbuf)
vhost_enable_extbuf(vid);
if (vsocket->linearbuf)
vhost_enable_linearbuf(vid);
+ if (vsocket->async_copy) {
+ dev = get_device(vid);
+
+ if (dev)
+ dev->async_copy = 1;
+ }
+
VHOST_LOG_CONFIG(INFO, "new device, handle is %d\n", vid);
if (vsocket->notify_ops->new_connection) {
}
vdpa_dev = vsocket->vdpa_dev;
- if (!vdpa_dev || !vdpa_dev->ops->get_features) {
+ if (!vdpa_dev) {
*features = vsocket->features;
goto unlock_exit;
}
}
vdpa_dev = vsocket->vdpa_dev;
- if (!vdpa_dev || !vdpa_dev->ops->get_protocol_features) {
+ if (!vdpa_dev) {
*protocol_features = vsocket->protocol_features;
goto unlock_exit;
}
}
vdpa_dev = vsocket->vdpa_dev;
- if (!vdpa_dev || !vdpa_dev->ops->get_queue_num) {
+ if (!vdpa_dev) {
*queue_num = VHOST_MAX_QUEUE_PAIRS;
goto unlock_exit;
}
goto out_free;
}
vsocket->vdpa_dev = NULL;
- vsocket->dequeue_zero_copy = flags & RTE_VHOST_USER_DEQUEUE_ZERO_COPY;
vsocket->extbuf = flags & RTE_VHOST_USER_EXTBUF_SUPPORT;
vsocket->linearbuf = flags & RTE_VHOST_USER_LINEARBUF_SUPPORT;
-
- if (vsocket->dequeue_zero_copy &&
- (flags & RTE_VHOST_USER_IOMMU_SUPPORT)) {
- VHOST_LOG_CONFIG(ERR,
- "error: enabling dequeue zero copy and IOMMU features "
- "simultaneously is not supported\n");
+ vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
+
+ if (vsocket->async_copy &&
+ (flags & (RTE_VHOST_USER_IOMMU_SUPPORT |
+ RTE_VHOST_USER_POSTCOPY_SUPPORT))) {
+ VHOST_LOG_CONFIG(ERR, "error: enabling async copy and IOMMU "
+ "or post-copy feature simultaneously is not "
+ "supported\n");
goto out_mutex;
}
vsocket->features = VIRTIO_NET_SUPPORTED_FEATURES;
vsocket->protocol_features = VHOST_USER_PROTOCOL_FEATURES;
- /*
- * Dequeue zero copy can't assure descriptors returned in order.
- * Also, it requires that the guest memory is populated, which is
- * not compatible with postcopy.
- */
- if (vsocket->dequeue_zero_copy) {
- if (vsocket->extbuf) {
- VHOST_LOG_CONFIG(ERR,
- "error: zero copy is incompatible with external buffers\n");
- ret = -1;
- goto out_mutex;
- }
- if (vsocket->linearbuf) {
- VHOST_LOG_CONFIG(ERR,
- "error: zero copy is incompatible with linear buffers\n");
- ret = -1;
- goto out_mutex;
- }
- if ((flags & RTE_VHOST_USER_CLIENT) != 0) {
- VHOST_LOG_CONFIG(ERR,
- "error: zero copy is incompatible with vhost client mode\n");
- ret = -1;
- goto out_mutex;
- }
- vsocket->supported_features &= ~(1ULL << VIRTIO_F_IN_ORDER);
- vsocket->features &= ~(1ULL << VIRTIO_F_IN_ORDER);
-
+ if (vsocket->async_copy) {
+ vsocket->supported_features &= ~(1ULL << VHOST_F_LOG_ALL);
+ vsocket->features &= ~(1ULL << VHOST_F_LOG_ALL);
VHOST_LOG_CONFIG(INFO,
- "Dequeue zero copy requested, disabling postcopy support\n");
- vsocket->protocol_features &=
- ~(1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT);
+ "Logging feature is disabled in async copy mode\n");
}
/*