X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fdevices%2Fvirtio%2Fvhost-user.c;h=ee41ee1858bd8042998aa64a0a80f27247cb3013;hb=553a41190963099631a73fb0a77b07b871d65e70;hp=bde8106c5012dd95b9875955175ae38565dcdd48;hpb=7cd468a3d7dee7d6c92f69a0bb7061ae208ec727;p=vpp.git diff --git a/src/vnet/devices/virtio/vhost-user.c b/src/vnet/devices/virtio/vhost-user.c index bde8106c501..ee41ee1858b 100644 --- a/src/vnet/devices/virtio/vhost-user.c +++ b/src/vnet/devices/virtio/vhost-user.c @@ -2325,9 +2325,13 @@ vhost_user_process (vlib_main_t * vm, strncpy (sun.sun_path, (char *) vui->sock_filename, sizeof (sun.sun_path) - 1); + /* Avoid hanging VPP if the other end does not accept */ + fcntl(sockfd, F_SETFL, O_NONBLOCK); if (connect (sockfd, (struct sockaddr *) &sun, sizeof (struct sockaddr_un)) == 0) { + /* Set the socket to blocking as it was before */ + fcntl(sockfd, F_SETFL, 0); vui->sock_errno = 0; template.file_descriptor = sockfd; template.private_data = @@ -2382,12 +2386,19 @@ VLIB_REGISTER_NODE (vhost_user_process_node,static) = { static void vhost_user_term_if (vhost_user_intf_t * vui) { + int q; + // Delete configured thread pinning vec_reset_length (vui->workers); // disconnect interface sockets vhost_user_if_disconnect (vui); vhost_user_update_iface_state (vui); + for (q = 0; q < VHOST_VRING_MAX_N; q++) + { + clib_mem_free ((void *) vui->vring_locks[q]); + } + if (vui->unix_server_index != ~0) { //Close server socket @@ -2578,6 +2589,11 @@ vhost_user_create_if (vnet_main_t * vnm, vlib_main_t * vm, int rv = 0; int server_sock_fd = -1; + if (sock_filename == NULL || !(strlen (sock_filename) > 0)) + { + return VNET_API_ERROR_INVALID_ARGUMENT; + } + if (is_server) { if ((rv =