X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flibrte_vhost%2Fsocket.c;h=aaa9c270776e9c818e9781223691e73cc3d3bffe;hb=5c1f70daafbca24fe10dc21afe44320e323d2f8f;hp=bf03f84d33b8e12977929ceb776d565c13dcb5cd;hpb=a277c715987647ecd4ec80d18c5cc95c28d9dfd3;p=dpdk.git diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index bf03f84d33..aaa9c27077 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -62,6 +62,7 @@ struct vhost_user_socket { int connfd; bool is_server; bool reconnect; + bool dequeue_zero_copy; }; struct vhost_user_connection { @@ -203,6 +204,9 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket) size = strnlen(vsocket->path, PATH_MAX); vhost_set_ifname(vid, vsocket->path, size); + if (vsocket->dequeue_zero_copy) + vhost_enable_dequeue_zero_copy(vid); + RTE_LOG(INFO, VHOST_CONFIG, "new device, handle is %d\n", vid); vsocket->connfd = fd; @@ -246,8 +250,8 @@ vhost_user_read_cb(int connfd, void *dat, int *remove) vsocket->connfd = -1; close(connfd); *remove = 1; - free(conn); vhost_destroy_device(conn->vid); + free(conn); if (vsocket->reconnect) vhost_user_create_client(vsocket); @@ -499,6 +503,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags) memset(vsocket, 0, sizeof(struct vhost_user_socket)); vsocket->path = strdup(path); vsocket->connfd = -1; + vsocket->dequeue_zero_copy = flags & RTE_VHOST_USER_DEQUEUE_ZERO_COPY; if ((flags & RTE_VHOST_USER_CLIENT) != 0) { vsocket->reconnect = !(flags & RTE_VHOST_USER_NO_RECONNECT);