X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=inline;f=vnet%2Fvnet%2Fdevices%2Fdpdk%2Fvhost_user.c;h=0df9f0bd1a1d2d0a902db628d848bc56e29e1f40;hb=5afccb2578d767e3a2be4316211ff38006c336a6;hp=2e7ecb18fb7ef5ad79aaad4eafe41e0109e3fcc8;hpb=3a94475e29f6b6efb7e6af30d5f171c6d3799b3d;p=vpp.git diff --git a/vnet/vnet/devices/dpdk/vhost_user.c b/vnet/vnet/devices/dpdk/vhost_user.c index 2e7ecb18fb7..0df9f0bd1a1 100644 --- a/vnet/vnet/devices/dpdk/vhost_user.c +++ b/vnet/vnet/devices/dpdk/vhost_user.c @@ -39,6 +39,8 @@ #define DBG_SOCK(args...) #endif +#if DPDK_VHOST_USER + static const char *vhost_message_str[] __attribute__((unused)) = { [VHOST_USER_NONE] = "VHOST_USER_NONE", [VHOST_USER_GET_FEATURES] = "VHOST_USER_GET_FEATURES", @@ -909,6 +911,8 @@ dpdk_vhost_user_if_disconnect(dpdk_device_t * xd) dpdk_vu_intf_t *vui = xd->vu_intf; vnet_main_t * vnm = vnet_get_main(); dpdk_main_t * dm = &dpdk_main; + struct vhost_virtqueue *vq; + int q; xd->admin_up = 0; vnet_hw_interface_set_flags (vnm, xd->vlib_hw_if_index, 0); @@ -924,6 +928,20 @@ dpdk_vhost_user_if_disconnect(dpdk_device_t * xd) vui->unix_fd = -1; vui->is_up = 0; + for (q = 0; q < vui->num_vrings; q++) { + vq = xd->vu_vhost_dev.virtqueue[q]; + vui->vrings[q].enabled = 0; /* Reset local copy */ + vui->vrings[q].callfd = -1; /* Reset FD */ + vq->enabled = 0; +#if RTE_VERSION >= RTE_VERSION_NUM(16, 4, 0, 0) + vq->log_guest_addr = 0; +#endif + vq->desc = NULL; + vq->used = NULL; + vq->avail = NULL; + } + xd->vu_is_running = 0; + dpdk_unmap_all_mem_regions(xd); DBG_SOCK("interface ifindex %d disconnected", xd->vlib_sw_if_index); } @@ -1335,8 +1353,8 @@ static clib_error_t * dpdk_vhost_user_socksvr_accept_ready (unix_file_t * uf) // init server socket on specified sock_filename static int dpdk_vhost_user_init_server_sock(const char * sock_filename, int *sockfd) { - int rv = 0, len; - struct sockaddr_un un; + int rv = 0; + struct sockaddr_un un = {}; int fd; /* create listening socket */ fd = socket(AF_UNIX, SOCK_STREAM, 0); @@ -1351,9 +1369,7 @@ static int dpdk_vhost_user_init_server_sock(const char * sock_filename, int *soc /* remove if exists */ unlink( (char *) sock_filename); - len = strlen((char *) un.sun_path) + strlen((char *) sock_filename); - - if (bind(fd, (struct sockaddr *) &un, len) == -1) { + if (bind(fd, (struct sockaddr *) &un, sizeof(un)) == -1) { rv = VNET_API_ERROR_SYSCALL_ERROR_2; goto error; } @@ -1901,3 +1917,4 @@ VLIB_CLI_COMMAND (show_vhost_user_command, static) = { .short_help = "show vhost-user interface", .function = show_dpdk_vhost_user_command_fn, }; +#endif