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.
14 #include "net/vhost-user.h"
15 #include "hw/virtio/vhost-user.h"
16 #include "chardev/char-fe.h"
18 #include "qapi/qapi-commands-net.h"
19 #include "qapi/qapi-events-net.h"
20 #include "qemu/config-file.h"
21 #include "qemu/error-report.h"
23 #include "trace.h"
38 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_get_vhost_net()
39 return s->vhost_net; in vhost_user_get_vhost_net()
45 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_get_acked_features()
46 return s->acked_features; in vhost_user_get_acked_features()
54 if (s->vhost_net) { in vhost_user_save_acked_features()
55 uint64_t features = vhost_net_get_acked_features(s->vhost_net); in vhost_user_save_acked_features()
57 s->acked_features = features; in vhost_user_save_acked_features()
68 assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_stop()
72 if (s->vhost_net) { in vhost_user_stop()
74 vhost_net_cleanup(s->vhost_net); in vhost_user_stop()
91 assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_start()
114 if (s->vhost_net) { in vhost_user_start()
115 vhost_net_cleanup(s->vhost_net); in vhost_user_start()
116 g_free(s->vhost_net); in vhost_user_start()
118 s->vhost_net = net; in vhost_user_start()
129 return -1; in vhost_user_start()
136 This fake RARP will be sent by backend only for guest in vhost_user_receive()
148 r = vhost_net_notify_migration_done(s->vhost_net, mac_addr); in vhost_user_receive()
152 "Vhost user backend fails to broadcast fake RARP\n"); in vhost_user_receive()
165 if (s->vhost_net) { in net_vhost_user_cleanup()
166 vhost_net_cleanup(s->vhost_net); in net_vhost_user_cleanup()
167 g_free(s->vhost_net); in net_vhost_user_cleanup()
168 s->vhost_net = NULL; in net_vhost_user_cleanup()
170 if (nc->queue_index == 0) { in net_vhost_user_cleanup()
171 if (s->watch) { in net_vhost_user_cleanup()
172 g_source_remove(s->watch); in net_vhost_user_cleanup()
173 s->watch = 0; in net_vhost_user_cleanup()
175 qemu_chr_fe_deinit(&s->chr, true); in net_vhost_user_cleanup()
176 if (s->vhost_user) { in net_vhost_user_cleanup()
177 vhost_user_cleanup(s->vhost_user); in net_vhost_user_cleanup()
178 g_free(s->vhost_user); in net_vhost_user_cleanup()
179 s->vhost_user = NULL; in net_vhost_user_cleanup()
187 bool enable) in vhost_user_set_vnet_endianness() argument
199 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_has_vnet_hdr()
206 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); in vhost_user_has_ufo()
216 if (!g_str_has_prefix(driver, "virtio-net-")) { in vhost_user_check_peer_type()
217 error_setg(errp, "vhost-user requires frontend driver virtio-net-*"); in vhost_user_check_peer_type()
241 qemu_chr_fe_disconnect(&s->chr); in net_vhost_user_watch()
263 for (i = queues -1; i >= 0; i--) { in chr_closed_bh()
269 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event, in chr_closed_bh()
293 chr = qemu_chr_fe_get_driver(&s->chr); in net_vhost_user_event()
294 trace_vhost_user_event(chr->label, event); in net_vhost_user_event()
297 if (vhost_user_start(queues, ncs, s->vhost_user) < 0) { in net_vhost_user_event()
298 qemu_chr_fe_disconnect(&s->chr); in net_vhost_user_event()
301 s->watch = qemu_chr_fe_add_watch(&s->chr, G_IO_HUP, in net_vhost_user_event()
304 s->started = true; in net_vhost_user_event()
305 qapi_event_send_netdev_vhost_user_connected(name, chr->label); in net_vhost_user_event()
313 if (s->watch) { in net_vhost_user_event()
316 g_source_remove(s->watch); in net_vhost_user_event()
317 s->watch = 0; in net_vhost_user_event()
318 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, NULL, in net_vhost_user_event()
352 qemu_set_info_str(nc, "vhost-user%d to %s", i, chr->label); in net_vhost_user_init()
353 nc->queue_index = i; in net_vhost_user_init()
357 if (!qemu_chr_fe_init(&s->chr, chr, &err) || in net_vhost_user_init()
358 !vhost_user_init(user, &s->chr, &err)) { in net_vhost_user_init()
364 s->vhost_user = user; in net_vhost_user_init()
369 if (qemu_chr_fe_wait_connected(&s->chr, &err) < 0) { in net_vhost_user_init()
373 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, in net_vhost_user_init()
374 net_vhost_user_event, NULL, nc0->name, NULL, in net_vhost_user_init()
376 } while (!s->started); in net_vhost_user_init()
378 assert(s->vhost_net); in net_vhost_user_init()
387 s->vhost_user = NULL; in net_vhost_user_init()
394 return -1; in net_vhost_user_init()
400 Chardev *chr = qemu_chr_find(opts->chardev); in net_vhost_claim_chardev()
403 error_setg(errp, "chardev \"%s\" not found", opts->chardev); in net_vhost_claim_chardev()
409 opts->chardev); in net_vhost_claim_chardev()
414 opts->chardev); in net_vhost_claim_chardev()
428 assert(netdev->type == NET_CLIENT_DRIVER_VHOST_USER); in net_init_vhost_user()
429 vhost_user_opts = &netdev->u.vhost_user; in net_init_vhost_user()
433 return -1; in net_init_vhost_user()
436 queues = vhost_user_opts->has_queues ? vhost_user_opts->queues : 1; in net_init_vhost_user()
439 "vhost-user number of queues must be in range [1, %d]", in net_init_vhost_user()
441 return -1; in net_init_vhost_user()