X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_vhost%2Fsocket.c;h=0169d364813de21bc6c74108bd26c68a6242f7f1;hb=9253c34cfb9dd32faeb8e513f6d8fafd356a2e62;hp=49267cebf93b6ff519daee950de014987b961476;hpb=2263f13941a10989d141e73529fa1b0fe356608b;p=dpdk.git diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 49267cebf9..0169d36481 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -37,11 +37,11 @@ struct vhost_user_socket { 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 @@ -205,6 +205,7 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket) size_t size; struct vhost_user_connection *conn; int ret; + struct virtio_net *dev; if (vsocket == NULL) return; @@ -227,15 +228,19 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket) 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) { @@ -701,7 +706,7 @@ rte_vhost_driver_get_features(const char *path, uint64_t *features) } vdpa_dev = vsocket->vdpa_dev; - if (!vdpa_dev || !vdpa_dev->ops->get_features) { + if (!vdpa_dev) { *features = vsocket->features; goto unlock_exit; } @@ -754,7 +759,7 @@ rte_vhost_driver_get_protocol_features(const char *path, } 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; } @@ -794,7 +799,7 @@ rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num) } 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; } @@ -869,15 +874,16 @@ rte_vhost_driver_register(const char *path, uint64_t flags) 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; } @@ -898,37 +904,11 @@ rte_vhost_driver_register(const char *path, uint64_t flags) 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"); } /*