#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",
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);
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);
}
// 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);
/* 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;
}
.short_help = "show vhost-user interface",
.function = show_dpdk_vhost_user_command_fn,
};
+#endif