On Tue, 15 Jul 2025 at 05:37, Jason Wang <jasow...@redhat.com> wrote: > > From: Laurent Vivier <lviv...@redhat.com> > > This commit adds support for the vhost-user interface to the passt > network backend, enabling high-performance, accelerated networking for > guests using passt. > > The passt backend can now operate in a vhost-user mode, where it > communicates with the guest's virtio-net device over a socket pair > using the vhost-user protocol. This offloads the datapath from the > main QEMU loop, significantly improving network performance. > > When the vhost-user=on option is used with -netdev passt, the new > vhost initialization path is taken instead of the standard > stream-based connection. > > Signed-off-by: Laurent Vivier <lviv...@redhat.com> > Signed-off-by: Jason Wang <jasow...@redhat.com>
Another couple of coverity issues: > +static int passt_vhost_user_start(NetPasstState *s, VhostUserState *be) > +{ > + struct vhost_net *net = NULL; > + VhostNetOptions options; > + > + options.backend_type = VHOST_BACKEND_TYPE_USER; > + options.net_backend = &s->data.nc; > + options.opaque = be; > + options.busyloop_timeout = 0; > + options.nvqs = 2; > + options.feature_bits = user_feature_bits; > + options.max_tx_queue_size = VIRTQUEUE_MAX_SIZE; > + options.get_acked_features = passt_get_acked_features; > + options.save_acked_features = passt_save_acked_features; > + options.is_vhost_user = true; > + > + net = vhost_net_init(&options); > + if (!net) { > + error_report("failed to init passt vhost_net"); > + goto err; > + } > + > + if (s->vhost_net) { > + vhost_net_cleanup(s->vhost_net); > + g_free(s->vhost_net); > + } > + s->vhost_net = net; > + > + return 0; > +err: > + if (net) { There is no path of code execution which can get here with net not being NULL, so this code in the if() is dead. CID 1612371. > + vhost_net_cleanup(net); > + g_free(net); > + } > + passt_vhost_user_stop(s); > + return -1; > +} > + > +static void passt_vhost_user_event(void *opaque, QEMUChrEvent event) > +{ > + NetPasstState *s = opaque; > + Error *err = NULL; We declare err here... > + > + switch (event) { > + case CHR_EVENT_OPENED: > + if (passt_vhost_user_start(s, s->vhost_user) < 0) { > + qemu_chr_fe_disconnect(&s->vhost_chr); > + return; > + } > + s->vhost_watch = qemu_chr_fe_add_watch(&s->vhost_chr, G_IO_HUP, > + passt_vhost_user_watch, s); > + net_client_set_link(&(NetClientState *){ &s->data.nc }, 1, true); > + s->started = true; > + break; > + case CHR_EVENT_CLOSED: > + if (s->vhost_watch) { > + AioContext *ctx = qemu_get_current_aio_context(); > + > + g_source_remove(s->vhost_watch); > + s->vhost_watch = 0; > + qemu_chr_fe_set_handlers(&s->vhost_chr, NULL, NULL, NULL, NULL, > + NULL, NULL, false); > + > + aio_bh_schedule_oneshot(ctx, chr_closed_bh, s); > + } > + break; > + case CHR_EVENT_BREAK: > + case CHR_EVENT_MUX_IN: > + case CHR_EVENT_MUX_OUT: > + /* Ignore */ > + break; > + } ...but we never use it in any of the event handling code.. > + > + if (err) { > + error_report_err(err); ...so this if() block is dead code. CID 1612375. > + } > +} thanks -- PMM