Lines Matching +full:- +full:- +full:enable +full:- +full:trace +full:- +full:backend
2 * vhost-user.c
7 * See the COPYING file in the top-level directory.
15 #include "hw/virtio/vhost-user.h"
16 #include "standard-headers/linux/virtio_net.h"
17 #include "chardev/char-fe.h"
19 #include "qapi/qapi-commands-net.h"
20 #include "qapi/qapi-events-net.h"
21 #include "qemu/config-file.h"
22 #include "qemu/error-report.h"
24 #include "trace.h"
79 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_get_vhost_net()
80 return s->vhost_net; in vhost_user_get_vhost_net()
86 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_get_acked_features()
87 return s->acked_features; in vhost_user_get_acked_features()
95 if (s->vhost_net) { in vhost_user_save_acked_features()
96 uint64_t features = vhost_net_get_acked_features(s->vhost_net); in vhost_user_save_acked_features()
98 s->acked_features = features; in vhost_user_save_acked_features()
109 assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_stop()
113 if (s->vhost_net) { in vhost_user_stop()
115 vhost_net_cleanup(s->vhost_net); in vhost_user_stop()
132 assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_start()
161 if (s->vhost_net) { in vhost_user_start()
162 vhost_net_cleanup(s->vhost_net); in vhost_user_start()
163 g_free(s->vhost_net); in vhost_user_start()
165 s->vhost_net = net; in vhost_user_start()
176 return -1; in vhost_user_start()
183 This fake RARP will be sent by backend only for guest in vhost_user_receive()
195 r = vhost_net_notify_migration_done(s->vhost_net, mac_addr); in vhost_user_receive()
199 "Vhost user backend fails to broadcast fake RARP\n"); in vhost_user_receive()
212 if (s->vhost_net) { in net_vhost_user_cleanup()
213 vhost_net_cleanup(s->vhost_net); in net_vhost_user_cleanup()
214 g_free(s->vhost_net); in net_vhost_user_cleanup()
215 s->vhost_net = NULL; in net_vhost_user_cleanup()
217 if (nc->queue_index == 0) { in net_vhost_user_cleanup()
218 if (s->watch) { in net_vhost_user_cleanup()
219 g_source_remove(s->watch); in net_vhost_user_cleanup()
220 s->watch = 0; in net_vhost_user_cleanup()
222 qemu_chr_fe_deinit(&s->chr, true); in net_vhost_user_cleanup()
223 if (s->vhost_user) { in net_vhost_user_cleanup()
224 vhost_user_cleanup(s->vhost_user); in net_vhost_user_cleanup()
225 g_free(s->vhost_user); in net_vhost_user_cleanup()
226 s->vhost_user = NULL; in net_vhost_user_cleanup()
234 bool enable) in vhost_user_set_vnet_endianness() argument
246 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_has_vnet_hdr()
253 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_has_ufo()
263 if (!g_str_has_prefix(driver, "virtio-net-")) { in vhost_user_check_peer_type()
264 error_setg(errp, "vhost-user requires frontend driver virtio-net-*"); in vhost_user_check_peer_type()
289 qemu_chr_fe_disconnect(&s->chr); in net_vhost_user_watch()
310 for (i = queues -1; i >= 0; i--) { in chr_closed_bh()
316 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event, in chr_closed_bh()
336 chr = qemu_chr_fe_get_driver(&s->chr); in net_vhost_user_event()
337 trace_vhost_user_event(chr->label, event); in net_vhost_user_event()
340 if (vhost_user_start(queues, ncs, s->vhost_user) < 0) { in net_vhost_user_event()
341 qemu_chr_fe_disconnect(&s->chr); in net_vhost_user_event()
344 s->watch = qemu_chr_fe_add_watch(&s->chr, G_IO_HUP, in net_vhost_user_event()
347 s->started = true; in net_vhost_user_event()
348 qapi_event_send_netdev_vhost_user_connected(name, chr->label); in net_vhost_user_event()
356 if (s->watch) { in net_vhost_user_event()
359 g_source_remove(s->watch); in net_vhost_user_event()
360 s->watch = 0; in net_vhost_user_event()
361 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, NULL, in net_vhost_user_event()
391 qemu_set_info_str(nc, "vhost-user%d to %s", i, chr->label); in net_vhost_user_init()
392 nc->queue_index = i; in net_vhost_user_init()
396 if (!qemu_chr_fe_init(&s->chr, chr, &err) || in net_vhost_user_init()
397 !vhost_user_init(user, &s->chr, &err)) { in net_vhost_user_init()
403 s->vhost_user = user; in net_vhost_user_init()
408 if (qemu_chr_fe_wait_connected(&s->chr, &err) < 0) { in net_vhost_user_init()
412 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, in net_vhost_user_init()
413 net_vhost_user_event, NULL, nc0->name, NULL, in net_vhost_user_init()
415 } while (!s->started); in net_vhost_user_init()
417 assert(s->vhost_net); in net_vhost_user_init()
426 s->vhost_user = NULL; in net_vhost_user_init()
433 return -1; in net_vhost_user_init()
439 Chardev *chr = qemu_chr_find(opts->chardev); in net_vhost_claim_chardev()
442 error_setg(errp, "chardev \"%s\" not found", opts->chardev); in net_vhost_claim_chardev()
448 opts->chardev); in net_vhost_claim_chardev()
453 opts->chardev); in net_vhost_claim_chardev()
467 assert(netdev->type == NET_CLIENT_DRIVER_VHOST_USER); in net_init_vhost_user()
468 vhost_user_opts = &netdev->u.vhost_user; in net_init_vhost_user()
472 return -1; in net_init_vhost_user()
475 queues = vhost_user_opts->has_queues ? vhost_user_opts->queues : 1; in net_init_vhost_user()
478 "vhost-user number of queues must be in range [1, %d]", in net_init_vhost_user()
480 return -1; in net_init_vhost_user()