+ addr.index = state.index = file.index = vring->queue_id & 1;
+ state.num = vring->size;
+ virtio_log_debug (vif, "VHOST_SET_VRING_NUM fd %d index %u num %u", fd,
+ state.index, state.num);
+ _IOCTL (fd, VHOST_SET_VRING_NUM, &state);
+
+ addr.flags = 0;
+ addr.desc_user_addr = pointer_to_uword (vring->desc);
+ addr.avail_user_addr = pointer_to_uword (vring->avail);
+ addr.used_user_addr = pointer_to_uword (vring->used);
+
+ virtio_log_debug (vif, "VHOST_SET_VRING_ADDR fd %d index %u flags 0x%x "
+ "desc_user_addr 0x%lx avail_user_addr 0x%lx "
+ "used_user_addr 0x%lx", fd, addr.index,
+ addr.flags, addr.desc_user_addr, addr.avail_user_addr,
+ addr.used_user_addr);
+ _IOCTL (fd, VHOST_SET_VRING_ADDR, &addr);
+
+ file.fd = vring->call_fd;
+ virtio_log_debug (vif, "VHOST_SET_VRING_CALL fd %d index %u call_fd %d",
+ fd, file.index, file.fd);
+ _IOCTL (fd, VHOST_SET_VRING_CALL, &file);
+
+ file.fd = vring->kick_fd;
+ virtio_log_debug (vif, "VHOST_SET_VRING_KICK fd %d index %u kick_fd %d",
+ fd, file.index, file.fd);
+ _IOCTL (fd, VHOST_SET_VRING_KICK, &file);
+
+ file.fd = tfd;
+ virtio_log_debug (vif, "VHOST_NET_SET_BACKEND fd %d index %u tap_fd %d",
+ fd, file.index, file.fd);
+ _IOCTL (fd, VHOST_NET_SET_BACKEND, &file);
+ }
+
+ if (vif->type == VIRTIO_IF_TYPE_TAP)
+ {
+ if (!args->mac_addr_set)
+ ethernet_mac_address_generate (args->mac_addr.bytes);